Re: querying without hits

2008-10-15 Thread Michael McCandless
If you want to keep every single hit, which is very dangerous for a large index, you should make a new collector. Here's an example (pulled from upcoming LIA revision): public class AllDocCollector extends HitCollector { List docs = new ArrayList(); public void collect(int doc, float sco

Re: querying without hits

2008-10-15 Thread David Massart
Thanks guys. Just looking at the examples and I wonder if there is a means to directly get the total number of hits. Or is it always necessary to search for a few top docs, get the the total number of hits and then create a new collector to get all the results? TopDocCollector collector = new TopD

Re: querying without hits

2008-10-14 Thread Chris Hostetter
: Could one of you point me to an example of code for querying without using : the deprecated class Hits ? The demo code included with Lucene releases was updated in Lucene 2.4 so that it does not use the Hits class. -Hoss -

Re: querying without hits

2008-10-14 Thread Ganesh
Hello David, Use TopDocs or TopFieldDocs to collect only required hits. TopDocs topDocs = searcher.search(query,10) int docID = topDocs.scoreDocs[index].doc; Document doc = searcher.doc(docID); Regards Ganesh - Original Message - From: "David Massart" <[EMAIL PROTECTED]>