mirror of https://github.com/apache/lucene.git
Oops. Fixed a bug I introduced in my last change. Thanks to
Cristoph for catching this! I overgeneralized. Sorted results are not always the highest scoring. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150535 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5a3cfc5372
commit
1b8843fa04
|
@ -123,15 +123,11 @@ public class IndexSearcher extends Searcher {
|
|||
new FieldSortedHitQueue(reader, sort.fields, nDocs);
|
||||
final int[] totalHits = new int[1];
|
||||
scorer.score(new HitCollector() {
|
||||
private float minScore = 0.0f;
|
||||
public final void collect(int doc, float score) {
|
||||
if (score > 0.0f && // ignore zeroed buckets
|
||||
(bits==null || bits.get(doc))) { // skip docs not in bits
|
||||
if (score > 0.0f && // ignore zeroed buckets
|
||||
(bits==null || bits.get(doc))) { // skip docs not in bits
|
||||
totalHits[0]++;
|
||||
if (hq.size() < nDocs || score >= minScore) {
|
||||
hq.insert(new FieldDoc(doc, score));
|
||||
minScore = ((FieldDoc)hq.top()).score; // maintain minScore
|
||||
}
|
||||
hq.insert(new FieldDoc(doc, score));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue