lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Max Lynch <>
Subject Converting HitCollector to Collector
Date Wed, 09 Dec 2009 18:58:35 GMT
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

 Searcher searcher = new IndexSearcher(indexReader);
 final BitSet bits = new BitSet(indexReader.maxDoc());, 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.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message