lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saisantoshi <>
Subject Re: Collector is collecting more than the specified hits
Date Fri, 14 Feb 2014 17:36:25 GMT
I am not interested in the scores at all. My requirement is simple, I only
need the first 100 hits or the numHits I specify ( irrespective of there
scores). The collector should stop after collecting the numHits specified.
Is there a way to tell in the collector to stop after collecting the

Please correct me if I am wrong. I am trying to do the following.

public void collect(int doc) throws IOException {

 if (collector.getTotalHits() <= maxHits ) {    // this way, I can stop it
to not collect after the getTotalHits is more than numHits.




I have to write a separate collector extending the Collector because I am
not able to get the call to getTotalHits() if I am using

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message