lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dor...@apache.org
Subject svn commit: r545024 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/DisjunctionMaxScorer.java src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
Date Thu, 07 Jun 2007 02:17:02 GMT
Author: doronc
Date: Wed Jun  6 19:17:02 2007
New Revision: 545024

URL: http://svn.apache.org/viewvc?view=rev&rev=545024
Log:
LUCENE-912: DisjunctionMaxScorer first skipTo(target) call ignores the 
            skip target param and ends up at the first match.

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?view=diff&rev=545024&r1=545023&r2=545024
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Wed Jun  6 19:17:02 2007
@@ -156,6 +156,10 @@
 21. LUCENE-903: FilteredQuery explanation inaccuracy with boost.
     Explanation tests now "deep" check the explanation details.
     (Chris Hostetter, Doron Cohen)
+    
+22. LUCENE-912: DisjunctionMaxScorer first skipTo(target) call ignores the 
+    skip target param and ends up at the first match.
+    (Sudaakeran B. via Chris Hostetter & Doron Cohen)
 
 New features
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java?view=diff&rev=545024&r1=545023&r2=545024
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java Wed Jun
 6 19:17:02 2007
@@ -117,7 +117,6 @@
           if (!more) return false;
           heapify();
           firstTime = false;
-          return true;   // more would have been false if no subScorers had any docs
         }
 
         while (subScorers.size()>0 && ((Scorer)subScorers.get(0)).doc()<target)
{

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?view=diff&rev=545024&r1=545023&r2=545024
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Wed Jun
 6 19:17:02 2007
@@ -29,6 +29,7 @@
 import org.apache.lucene.store.RAMDirectory;
 
 import java.text.DecimalFormat;
+import java.io.IOException;
 
 /**
  * Test of the DisjunctionMaxQuery.
@@ -124,6 +125,36 @@
         s = new IndexSearcher(r);
         s.setSimilarity(sim);
     }
+
+  public void testSkipToFirsttimeMiss() throws IOException {
+    final DisjunctionMaxQuery dq = new DisjunctionMaxQuery(0.0f);
+    dq.add(tq("id","d1"));
+    dq.add(tq("dek","DOES_NOT_EXIST"));
+
+    QueryUtils.check(dq,s);
+
+    final Weight dw = dq.weight(s);
+    final Scorer ds = dw.scorer(r);
+    final boolean skipOk = ds.skipTo(3);
+    if (skipOk) {
+      fail("firsttime skipTo found a match? ... " + 
+            r.document(ds.doc()).get("id"));
+    }
+  }
+
+  public void testSkipToFirsttimeHit() throws IOException {
+    final DisjunctionMaxQuery dq = new DisjunctionMaxQuery(0.0f);
+    dq.add(tq("dek","albino"));
+    dq.add(tq("dek","DOES_NOT_EXIST"));
+
+    QueryUtils.check(dq,s);
+
+    final Weight dw = dq.weight(s);
+    final Scorer ds = dw.scorer(r);
+    assertTrue("firsttime skipTo found no match", ds.skipTo(3));
+    assertEquals("found wrong docid", "d4", r.document(ds.doc()).get("id"));
+  }
+
 
 
     public void testSimpleEqualScores1() throws Exception {



Mime
View raw message