Apache Lucene open-source search software
if only score or id is accessed, don't load the document (as that causes a disk access)
Daniel Naber748b2419e9bd
diff --git a/src/java/org/apache/lucene/search/Hit.java b/src/java/org/apache/lucene/search/Hit.javaindex 1e300b23477..8283bc8685d 100644--- a/src/java/org/apache/lucene/search/Hit.java+++ b/src/java/org/apache/lucene/search/Hit.java@@ -28,8 +28,6 @@ import org.apache.lucene.document.Document;*/public class Hit implements java.io.Serializable {- private float score;- private int id;private Document doc = null;private boolean resolved = false;@@ -63,8 +61,7 @@ public class Hit implements java.io.Serializable {* @see Hits#score(int)*/public float getScore() throws IOException {- if (!resolved) fetchTheHit();- return score;+ return hits.score(hitNumber);}/**@@ -73,14 +70,11 @@ public class Hit implements java.io.Serializable {* @see Hits#id(int)*/public int getId() throws IOException {- if (!resolved) fetchTheHit();- return id;+ return hits.id(hitNumber);}private void fetchTheHit() throws IOException {doc = hits.doc(hitNumber);- score = hits.score(hitNumber);- id = hits.id(hitNumber);resolved = true;}