Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Added accessor method to get HitDoc global id from Hits. This id needs to be used in sorting.

Peter Carlson19a3915b3c6d
diff --git a/src/java/org/apache/lucene/search/Hits.java b/src/java/org/apache/lucene/search/Hits.java
index c25db7faaff..bb9970b6da5 100644
--- a/src/java/org/apache/lucene/search/Hits.java
+++ b/src/java/org/apache/lucene/search/Hits.java
@@ -132,6 +132,12 @@ public final class Hits {
public final float score(int n) throws IOException {
return hitDoc(n).score;
}
+
+ /** Returns the id for the nth document in this set. */
+ public final float id(int n) throws IOException {
+ return hitDoc(n).id;
+ }
+
private final HitDoc hitDoc(int n) throws IOException {
if (n >= length)