On Monday 29 May 2006 15:54, zzzzz shalev wrote: > hi all, > > is there a faster way to retrieve ONLY the count of results for a query? > > lucene ranks (scores) the first batch of docs and sorts them by rank, this is functionality i dont need in certain queries and i assume, not doing this can return the count faster then the hits.length()
Untested: Scorer scorer = query.weight(indexSearcher).scorer(indexSearcher.getIndexReader()); int docCount = 0; while (scorer.next()) docCount++; Regards, Paul Elschot --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]