Hi,
I have a HitCollector that processes all hits from a query. I want all
hits, not the top N hits. I am converting my HitCollector to a Collector
for Lucene 3.0.0, and I'm a little confused by the new interface.
I assume that I can implement by new Collector much like the code on the API
Docs:
Searcher searcher = new IndexSearcher(indexReader);
final BitSet bits = new BitSet(indexReader.maxDoc());
searcher.search(query, new Collector() {
private int docBase;
*// ignore scorer*
public void setScorer(Scorer scorer) {
}
*// accept docs out of order (for a BitSet it doesn't matter)*
public boolean acceptsDocsOutOfOrder() {
return true;
}
public void collect(int doc) {
bits.set(doc + docBase);
}
public void setNextReader(IndexReader reader, int docBase) {
this.docBase = docBase;
}
});
But I'm confused what the docBasing is (I need to get fields from each
document from my index searcher). Do I need to use the doc base or
setNextReader? Also, what is the purpose of acceptsDocsOutOfOrder? I
see the docs note on it but I'm not sure how I could apply that or if
I should care about it.
Thanks,
Max