Browse Source

Organized imports

Abhinav Sarkar 7 years ago
parent
commit
c8dcc52766

+ 2
- 7
src/main/scala/net/abhinavsarkar/ircsearch/HttpRequestHandler.scala View File

@@ -3,15 +3,10 @@ package net.abhinavsarkar.ircsearch
3 3
 import com.typesafe.scalalogging.slf4j.Logging
4 4
 
5 5
 import io.netty.buffer.Unpooled
6
-import io.netty.channel.ChannelFutureListener
7
-import io.netty.channel.ChannelHandlerContext
8
-import io.netty.channel.ChannelInboundMessageHandlerAdapter
9
-import io.netty.handler.codec.http.DefaultHttpResponse
10
-import io.netty.handler.codec.http.HttpHeaders
6
+import io.netty.channel.{ ChannelFutureListener, ChannelHandlerContext, ChannelInboundMessageHandlerAdapter }
7
+import io.netty.handler.codec.http.{ DefaultHttpResponse, HttpHeaders, HttpRequest, HttpResponse }
11 8
 import io.netty.handler.codec.http.HttpHeaders.Names._
12 9
 import io.netty.handler.codec.http.HttpHeaders.isKeepAlive
13
-import io.netty.handler.codec.http.HttpRequest
14
-import io.netty.handler.codec.http.HttpResponse
15 10
 import io.netty.handler.codec.http.HttpResponseStatus._
16 11
 import io.netty.handler.codec.http.HttpVersion.HTTP_1_1
17 12
 

+ 10
- 17
src/main/scala/net/abhinavsarkar/ircsearch/Server.scala View File

@@ -10,28 +10,21 @@ import scala.concurrent.future
10 10
 import com.typesafe.scalalogging.slf4j.Logging
11 11
 
12 12
 import au.com.bytecode.opencsv.CSVParser
13
+
13 14
 import io.netty.bootstrap.ServerBootstrap
14 15
 import io.netty.buffer.ByteBuf
15 16
 import io.netty.channel.ChannelHandler.Sharable
16
-import io.netty.channel.ChannelHandlerContext
17
-import io.netty.channel.ChannelInboundByteHandlerAdapter
18
-import io.netty.channel.ChannelInboundMessageHandlerAdapter
19
-import io.netty.channel.ChannelInitializer
17
+import io.netty.channel.{ ChannelHandlerContext, ChannelInboundByteHandlerAdapter,
18
+                          ChannelInboundMessageHandlerAdapter, ChannelInitializer }
20 19
 import io.netty.channel.socket.SocketChannel
21
-import io.netty.channel.socket.nio.NioEventLoopGroup
22
-import io.netty.channel.socket.nio.NioServerSocketChannel
23
-import io.netty.handler.codec.DelimiterBasedFrameDecoder
24
-import io.netty.handler.codec.Delimiters
25
-import io.netty.handler.codec.http.HttpChunkAggregator
26
-import io.netty.handler.codec.http.HttpContentCompressor
27
-import io.netty.handler.codec.http.HttpMethod
28
-import io.netty.handler.codec.http.HttpRequest
29
-import io.netty.handler.codec.http.HttpRequestDecoder
30
-import io.netty.handler.codec.http.HttpResponseEncoder
31
-import io.netty.handler.codec.http.QueryStringDecoder
20
+import io.netty.channel.socket.nio.{ NioEventLoopGroup, NioServerSocketChannel }
21
+import io.netty.handler.codec.{ DelimiterBasedFrameDecoder, Delimiters }
22
+import io.netty.handler.codec.http.{ HttpChunkAggregator, HttpContentCompressor, HttpMethod,
23
+                                     HttpRequest, HttpRequestDecoder, HttpResponseEncoder,
24
+                                     QueryStringDecoder }
32 25
 import io.netty.handler.codec.string.StringDecoder
33
-import net.abhinavsarkar.ircsearch.lucene.Indexer
34
-import net.abhinavsarkar.ircsearch.lucene.Searcher
26
+
27
+import net.abhinavsarkar.ircsearch.lucene._
35 28
 import net.abhinavsarkar.ircsearch.model._
36 29
 import net.liftweb.json.DefaultFormats
37 30
 import net.liftweb.json.Serialization

+ 3
- 12
src/main/scala/net/abhinavsarkar/ircsearch/lucene/Indexer.scala View File

@@ -2,10 +2,7 @@ package net.abhinavsarkar.ircsearch.lucene
2 2
 
3 3
 import java.io.File
4 4
 import java.util.ArrayList
5
-import java.util.concurrent.Executors
6
-import java.util.concurrent.Future
7
-import java.util.concurrent.PriorityBlockingQueue
8
-import java.util.concurrent.TimeUnit
5
+import java.util.concurrent.{ Executors, Future, PriorityBlockingQueue, TimeUnit }
9 6
 import java.util.concurrent.locks.ReentrantLock
10 7
 
11 8
 import scala.collection.JavaConversions._
@@ -18,12 +15,8 @@ import org.apache.lucene.analysis.core.KeywordAnalyzer
18 15
 import org.apache.lucene.analysis.en.EnglishAnalyzer
19 16
 import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper
20 17
 import org.apache.lucene.analysis.standard.StandardAnalyzer
21
-import org.apache.lucene.document.Field
22
-import org.apache.lucene.document.LongField
23
-import org.apache.lucene.document.StringField
24
-import org.apache.lucene.document.TextField
25
-import org.apache.lucene.index.IndexWriter
26
-import org.apache.lucene.index.IndexWriterConfig
18
+import org.apache.lucene.document.{ Field, LongField, StringField, TextField }
19
+import org.apache.lucene.index.{ IndexWriter, IndexWriterConfig }
27 20
 import org.apache.lucene.store.FSDirectory
28 21
 import org.apache.lucene.util.Version
29 22
 
@@ -44,14 +37,12 @@ object Indexer extends Logging {
44 37
   }
45 38
 
46 39
   object IndexRecord {
47
-
48 40
     def fromIndexRequest(indexRequest : IndexRequest) = {
49 41
       val IndexRequest(server, channel, botName, chatLines) = indexRequest
50 42
       for {
51 43
         chatLine <- chatLines
52 44
       } yield new IndexRecord(server, channel, botName, chatLine)
53 45
     }
54
-
55 46
   }
56 47
 
57 48
   val LUCENE_VERSION = Version.LUCENE_43

+ 4
- 14
src/main/scala/net/abhinavsarkar/ircsearch/lucene/Searcher.scala View File

@@ -1,8 +1,7 @@
1 1
 package net.abhinavsarkar.ircsearch.lucene
2 2
 
3 3
 import java.io.File
4
-import java.text.ParseException
5
-import java.text.SimpleDateFormat
4
+import java.text.{ SimpleDateFormat,  ParseException }
6 5
 
7 6
 import scala.collection.JavaConversions._
8 7
 import scala.collection.immutable.Map
@@ -12,18 +11,9 @@ import scala.collection.mutable.Buffer
12 11
 import org.apache.lucene.analysis.Analyzer
13 12
 import org.apache.lucene.queries.ChainedFilter
14 13
 import org.apache.lucene.queryparser.classic.MultiFieldQueryParser
15
-import org.apache.lucene.search.BooleanClause
16
-import org.apache.lucene.search.BooleanQuery
17
-import org.apache.lucene.search.Filter
18
-import org.apache.lucene.search.FilteredQuery
19
-import org.apache.lucene.search.NumericRangeFilter
20
-import org.apache.lucene.search.Query
21
-import org.apache.lucene.search.QueryWrapperFilter
22
-import org.apache.lucene.search.SearcherFactory
23
-import org.apache.lucene.search.SearcherManager
24
-import org.apache.lucene.search.Sort
25
-import org.apache.lucene.search.SortField
26
-import org.apache.lucene.search.TermQuery
14
+import org.apache.lucene.search.{ BooleanClause, BooleanQuery,  Filter, FilteredQuery,
15
+                                  NumericRangeFilter, Query, QueryWrapperFilter, SearcherFactory,
16
+                                  SearcherManager,  Sort, SortField, TermQuery }
27 17
 import org.apache.lucene.store.FSDirectory
28 18
 
29 19
 import com.typesafe.scalalogging.slf4j.Logging

Loading…
Cancel
Save