From 6bccd58110bdc1d8b6e5a29e7b0894458f31203b Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Thu, 28 May 2009 02:23:05 +0000 Subject: [PATCH] SOLR-1111: also use lucene filters for generating docsets git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@779403 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/solr/search/SolrIndexSearcher.java | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/src/java/org/apache/solr/search/SolrIndexSearcher.java b/src/java/org/apache/solr/search/SolrIndexSearcher.java index 6e87d0f4a98..d179227088f 100644 --- a/src/java/org/apache/solr/search/SolrIndexSearcher.java +++ b/src/java/org/apache/solr/search/SolrIndexSearcher.java @@ -33,6 +33,7 @@ import org.apache.solr.core.SolrInfoMBean; import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.SchemaField; import org.apache.solr.request.UnInvertedField; +import org.apache.solr.search.function.BoostedQuery; import org.apache.lucene.util.OpenBitSet; import java.io.IOException; @@ -618,9 +619,10 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { } // query must be positive - protected DocSet getDocSetNC(Query query, DocSet filter) throws IOException { + protected DocSet getDocSetNC(Query query, DocSet filter) throws IOException { + DocSetCollector collector = new DocSetCollector(maxDoc()>>6, maxDoc()); + if (filter==null) { - DocSetCollector hc = new DocSetCollector(maxDoc()>>6, maxDoc()); if (query instanceof TermQuery) { Term t = ((TermQuery)query).getTerm(); SolrIndexReader[] readers = reader.getLeafReaders(); @@ -630,42 +632,26 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { for (int i=0; i>6, maxDoc()); - final DocSet filt = filter; - super.search(query, null, new Collector() { - int base = 0; - public void collect(int doc) throws IOException { - doc += base; - if (filt.exists(doc)) hc.collect(doc); - } - - public void setNextReader(IndexReader reader, int docBase) throws IOException { - this.base = docBase; - } - - public void setScorer(Scorer scorer) throws IOException { - } - } - ); - return hc.getDocSet(); + Filter luceneFilter = filter.getTopFilter(); + super.search(query, luceneFilter, collector); + return collector.getDocSet(); } }