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:36:25 GMT
If you just want to fetch all the matching documents for a given query,
implement a collector that just saves the document data.

final ArrayList<Document> docs = new ArrayList<Document>();
searcher.search( query, new HitCollector() {
    public void collect(int doc, float score) {
        docs.add(searcher.doc(doc));
    }
});


See also
http://stackoverflow.com/questions/973354/migrating-from-hit-hits-to-topdocs-topdoccollector

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