blob: 46339454d5d3d2547d0a2efcc46a6c49d3d16dc7 [file] [log] [blame]
Index: src/java/org/apache/lucene/search/FieldValueHitQueue.java
===================================================================
--- src/java/org/apache/lucene/search/FieldValueHitQueue.java (revision 834707)
+++ src/java/org/apache/lucene/search/FieldValueHitQueue.java (working copy)
@@ -36,20 +36,17 @@
*/
public abstract class FieldValueHitQueue extends PriorityQueue<FieldValueHitQueue.Entry> {
- final static class Entry {
+ final static class Entry extends ScoreDoc {
int slot;
- int docID;
- float score;
- Entry(int slot, int docID, float score) {
+ Entry(int slot, int doc, float score) {
+ super(doc, score);
this.slot = slot;
- this.docID = docID;
- this.score = score;
}
@Override
public String toString() {
- return "slot:" + slot + " docID:" + docID + " score=" + score;
+ return "slot:" + slot + " " + super.toString();
}
}
@@ -97,7 +94,7 @@
}
// avoid random sort order that could lead to duplicates (bug #31241):
- return hitA.docID > hitB.docID;
+ return hitA.doc > hitB.doc;
}
}
@@ -139,7 +136,7 @@
}
// avoid random sort order that could lead to duplicates (bug #31241):
- return hitA.docID > hitB.docID;
+ return hitA.doc > hitB.doc;
}
}
@@ -214,7 +211,7 @@
fields[i] = comparators[i].value(entry.slot);
}
//if (maxscore > 1.0f) doc.score /= maxscore; // normalize scores
- return new FieldDoc(entry.docID, entry.score, fields);
+ return new FieldDoc(entry.doc, entry.score, fields);
}
/** Returns the SortFields being used by this hit queue. */
Index: src/java/org/apache/lucene/search/TopDocsCollector.java
===================================================================
--- src/java/org/apache/lucene/search/TopDocsCollector.java (revision 834707)
+++ src/java/org/apache/lucene/search/TopDocsCollector.java (working copy)
@@ -28,7 +28,7 @@
* Extending classes can override {@link #topDocs(int, int)} and
* {@link #getTotalHits()} in order to provide their own implementation.
*/
-public abstract class TopDocsCollector<T> extends Collector {
+public abstract class TopDocsCollector<T extends ScoreDoc> extends Collector {
// This is used in case topDocs() is called with illegal parameters, or there
// simply aren't (enough) results.
@@ -55,7 +55,7 @@
*/
protected void populateResults(ScoreDoc[] results, int howMany) {
for (int i = howMany - 1; i >= 0; i--) {
- results[i] = (ScoreDoc) pq.pop();
+ results[i] = pq.pop();
}
}
Index: src/java/org/apache/lucene/search/TopFieldCollector.java
===================================================================
--- src/java/org/apache/lucene/search/TopFieldCollector.java (revision 834707)
+++ src/java/org/apache/lucene/search/TopFieldCollector.java (working copy)
@@ -59,7 +59,7 @@
final void updateBottom(int doc) {
// bottom.score is already set to Float.NaN in add().
- bottom.docID = docBase + doc;
+ bottom.doc = docBase + doc;
bottom = pq.updateTop();
}
@@ -122,7 +122,7 @@
if (queueFull) {
// Fastmatch: return if this hit is not competitive
final int cmp = reverseMul * comparator.compareBottom(doc);
- if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID)) {
+ if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
return;
}
@@ -164,7 +164,7 @@
}
final void updateBottom(int doc, float score) {
- bottom.docID = docBase + doc;
+ bottom.doc = docBase + doc;
bottom.score = score;
bottom = pq.updateTop();
}
@@ -230,7 +230,7 @@
if (queueFull) {
// Fastmatch: return if this hit is not competitive
final int cmp = reverseMul * comparator.compareBottom(doc);
- if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID)) {
+ if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
return;
}
@@ -280,7 +280,7 @@
}
final void updateBottom(int doc, float score) {
- bottom.docID = docBase + doc;
+ bottom.doc = docBase + doc;
bottom.score = score;
bottom = pq.updateTop();
}
@@ -347,7 +347,7 @@
if (queueFull) {
// Fastmatch: return if this hit is not competitive
final int cmp = reverseMul * comparator.compareBottom(doc);
- if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID)) {
+ if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
return;
}
@@ -392,7 +392,7 @@
final void updateBottom(int doc) {
// bottom.score is already set to Float.NaN in add().
- bottom.docID = docBase + doc;
+ bottom.doc = docBase + doc;
bottom = pq.updateTop();
}
@@ -488,7 +488,7 @@
break;
} else if (i == comparators.length - 1) {
// This is the equals case.
- if (doc + docBase > bottom.docID) {
+ if (doc + docBase > bottom.doc) {
// Definitely not competitive
return;
}
@@ -545,7 +545,7 @@
}
final void updateBottom(int doc, float score) {
- bottom.docID = docBase + doc;
+ bottom.doc = docBase + doc;
bottom.score = score;
bottom = pq.updateTop();
}
@@ -640,7 +640,7 @@
break;
} else if (i == comparators.length - 1) {
// This is the equals case.
- if (doc + docBase > bottom.docID) {
+ if (doc + docBase > bottom.doc) {
// Definitely not competitive
return;
}
@@ -695,7 +695,7 @@
}
final void updateBottom(int doc, float score) {
- bottom.docID = docBase + doc;
+ bottom.doc = docBase + doc;
bottom.score = score;
bottom = pq.updateTop();
}
@@ -788,7 +788,7 @@
break;
} else if (i == comparators.length - 1) {
// This is the equals case.
- if (doc + docBase > bottom.docID) {
+ if (doc + docBase > bottom.doc) {
// Definitely not competitive
return;
}
@@ -972,7 +972,7 @@
} else {
for (int i = howMany - 1; i >= 0; i--) {
Entry entry = pq.pop();
- results[i] = new FieldDoc(entry.docID, entry.score);
+ results[i] = new FieldDoc(entry.doc, entry.score);
}
}
}