lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saisantoshi <saisantosh...@gmail.com>
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
numHits.

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.

        delegate.collect(doc); 

}

}

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
PositiveScoresOnlyCollector.





--
View this message in context: http://lucene.472066.n3.nabble.com/Collector-is-collecting-more-than-the-specified-hits-tp4117329p4117441.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
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