lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r433081 - /lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java
Date Sun, 20 Aug 2006 23:11:00 GMT
Author: gsingers
Date: Sun Aug 20 16:11:00 2006
New Revision: 433081

URL: http://svn.apache.org/viewvc?rev=433081&view=rev
Log:
Changed explain method to use TermDocs.skipTo instead of looping.

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

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java?rev=433081&r1=433080&r2=433081&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/TermScorer.java Sun Aug 20 16:11:00
2006
@@ -157,7 +157,6 @@
    * <br>When this method is used, the {@link #next()} method
    * and the {@link #score(HitCollector)} method should not be used.
    * @param doc The document number for the explanation.
-   * @todo Modify to make use of {@link TermDocs#skipTo(int)}.
    */
   public Explanation explain(int doc) throws IOException {
     TermQuery query = (TermQuery)weight.getQuery();
@@ -169,11 +168,13 @@
       pointer++;
     }
     if (tf == 0) {
-      while (termDocs.next()) {
-        if (termDocs.doc() == doc) {
-          tf = termDocs.freq();
+        if (termDocs.skipTo(doc))
+        {
+            if (termDocs.doc() == doc)
+            {
+                tf = termDocs.freq();
+            }
         }
-      }
     }
     termDocs.close();
     tfExplanation.setValue(getSimilarity().tf(tf));



Mime
View raw message