Fix failing unit test - TestTopDocsCollector#testResultsOrder (#13621)

This commit is contained in:
Jakub Slowinski 2024-08-02 13:03:09 +01:00 committed by GitHub
parent ad2f02c013
commit 1ce1156de4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -72,9 +72,6 @@ public class TestTopDocsCollector extends LuceneTestCase {
}
private static final class MyTopDocsCollector extends TopDocsCollector<ScoreDoc> {
private int idx = 0;
public MyTopDocsCollector(int size) {
super(new HitQueue(size, false));
}
@ -92,11 +89,12 @@ public class TestTopDocsCollector extends LuceneTestCase {
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
final int base = context.docBase;
return new LeafCollector() {
private int idx = 0;
@Override
public void collect(int doc) {
++totalHits;
pq.insertWithOverflow(new ScoreDoc(doc + base, scores[idx++]));
pq.insertWithOverflow(new ScoreDoc(doc + base, scores[context.docBase + idx++]));
}
@Override