lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Israel Tsadok <itsa...@gmail.com>
Subject Re: Extracting all documents for a given search
Date Mon, 19 Sep 2011 08:45:37 GMT
Ahem, sorry. I quoted an old answer of mine, but HitCollector has been gone
for a while now...
This is the modern version:

final ArrayList<Document> docs = new ArrayList<Document>();
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) {
     doc.add(searcher.doc(doc + docBase));
   }

   public void setNextReader(IndexReader reader, int docBase) {
     this.docBase = docBase;
   }

});

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