|
@ -10,7 +10,6 @@ import org.apache.lucene.index.DirectoryReader; |
|
|
import org.apache.lucene.index.IndexReader; |
|
|
import org.apache.lucene.index.IndexReader; |
|
|
import org.apache.lucene.index.Term; |
|
|
import org.apache.lucene.index.Term; |
|
|
import org.apache.lucene.util.BytesRef; |
|
|
import org.apache.lucene.util.BytesRef; |
|
|
import org.nl.modules.lucence.common.LuceneIndexWriter; |
|
|
|
|
|
import org.apache.lucene.queryparser.classic.QueryParser; |
|
|
import org.apache.lucene.queryparser.classic.QueryParser; |
|
|
import org.apache.lucene.search.*; |
|
|
import org.apache.lucene.search.*; |
|
|
import org.apache.lucene.store.Directory; |
|
|
import org.apache.lucene.store.Directory; |
|
@ -97,10 +96,11 @@ public class Searcher { |
|
|
ScoreDoc[] scoreDocs = docs.scoreDocs; |
|
|
ScoreDoc[] scoreDocs = docs.scoreDocs; |
|
|
if (end > docs.totalHits.value) end = (int) docs.totalHits.value; |
|
|
if (end > docs.totalHits.value) end = (int) docs.totalHits.value; |
|
|
JSONArray array = new JSONArray(); |
|
|
JSONArray array = new JSONArray(); |
|
|
JSONObject object = new JSONObject(); |
|
|
|
|
|
for (int i = start; i < end; i++) { |
|
|
for (int i = start; i < end; i++) { |
|
|
ScoreDoc scoreDoc = scoreDocs[i]; |
|
|
ScoreDoc scoreDoc = scoreDocs[i]; |
|
|
Document doc = reader.document(scoreDoc.doc); |
|
|
Document doc = reader.document(scoreDoc.doc); |
|
|
|
|
|
JSONObject object = new JSONObject(); |
|
|
object.put("content",doc.get("fieldContent")); |
|
|
object.put("content",doc.get("fieldContent")); |
|
|
object.put("device_code",doc.get("device_code")); |
|
|
object.put("device_code",doc.get("device_code")); |
|
|
object.put("logTime",doc.get("logTime")); |
|
|
object.put("logTime",doc.get("logTime")); |
|
|