lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r189448 - /lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java
Date Tue, 07 Jun 2005 21:46:51 GMT
Author: dnaber
Date: Tue Jun  7 14:46:50 2005
New Revision: 189448

URL: http://svn.apache.org/viewcvs?rev=189448&view=rev
Log:
if only score or id is accessed, don't load the document (as that causes
a disk access)

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java?rev=189448&r1=189447&r2=189448&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Hit.java Tue Jun  7 14:46:50 2005
@@ -28,8 +28,6 @@
  */
 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 @@
    * @see Hits#score(int)
    */
   public float getScore() throws IOException {
-    if (!resolved) fetchTheHit();
-    return score;
+    return hits.score(hitNumber);
   }
 
   /**
@@ -73,14 +70,11 @@
    * @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;
   }
 



Mime
View raw message