You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2011/08/17 18:50:04 UTC
svn commit: r1158824 -
/incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java
Author: joern
Date: Wed Aug 17 16:50:04 2011
New Revision: 1158824
URL: http://svn.apache.org/viewvc?rev=1158824&view=rev
Log:
OPENNLP-249 Changed searcher to reflect new mapping file.
Modified:
incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java
Modified: incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java?rev=1158824&r1=1158823&r2=1158824&view=diff
==============================================================================
--- incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java (original)
+++ incubator/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/search/LuceneSearchService.java Wed Aug 17 16:50:04 2011
@@ -34,6 +34,7 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
@@ -251,7 +252,7 @@ public class LuceneSearchService impleme
}
@Override
- public Collection<String> search(CorpusStore store, String q)
+ public List<String> search(CorpusStore store, String q)
throws IOException {
// TODO:
@@ -263,7 +264,7 @@ public class LuceneSearchService impleme
QueryParser parser = null;
final IndexSearcher searcher = new IndexSearcher(indexLocation.getAbsolutePath());
- parser = new QueryParser("content", new StandardAnalyzer());
+ parser = new QueryParser("text", new WhitespaceAnalyzer());
Query query;
try {
@@ -272,17 +273,18 @@ public class LuceneSearchService impleme
throw new IOException(e);
}
- final Set<String> results = new HashSet<String>();
+ final List<String> results = new ArrayList<String>();
// query index ...
searcher.search(query, new Collector() {
+
@Override
public void setScorer(Scorer scorer) throws IOException {
}
@Override
- public void setNextReader(IndexReader reader, int arg1) throws IOException {
+ public void setNextReader(IndexReader reader, int docBase) throws IOException {
}
@Override