lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <paul.elsc...@xs4all.nl>
Subject Re: fastest way to get raw hit count
Date Mon, 29 May 2006 17:28:27 GMT
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message