BitSet in a HitCollector

2006-07-05 Thread James Pine
Hey Everyone, I'm using a HitCollector and would like to know the total number of results that matched a given query. Based on the JavaDoc, I this will do the trick: Searcher searcher = new IndexSearcher(indexReader); final BitSet bits = new BitSet(indexReader.maxDoc()); searcher.search(que

Re: BitSet in a HitCollector

2006-07-05 Thread Chris Hostetter
: I'm using a HitCollector and would like to know the : total number of results that matched a given query. : Based on the JavaDoc, I this will do the trick: you don't need a BitSet in that case, you could find that out just using an int... public CountingCollector extends HitCollector {

Re: BitSet in a HitCollector

2006-07-06 Thread James Pine
Hey, Sorry, I will explain a bit more about my collect method. Currently my collect method is executing IndexSearcher.doc(id) and storing some stuff in a Map which I can then retrieve from the HitCollector (much like the example in the Lucene In Action book). Of course that's somewhat expensive, s

Re: BitSet in a HitCollector

2006-07-06 Thread Tricia Williams
Hi James, A paper was mentioned on this list in the last couple of months which presents a solution to your sampling problem without having to know the total results size in advance. The paper (http://www2005.org/cdrom/docs/p245.pdf) presents two solutions which utilize a random variable.