| Index: src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java |
| =================================================================== |
| --- src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (revision 544714) |
| +++ src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (working copy) |
| @@ -29,6 +29,7 @@ |
| import org.apache.lucene.store.RAMDirectory; |
| |
| import java.text.DecimalFormat; |
| +import java.io.IOException; |
| |
| /** |
| * Test of the DisjunctionMaxQuery. |
| @@ -125,7 +126,37 @@ |
| 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 { |
| |
| DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.0f); |
| Index: src/java/org/apache/lucene/search/DisjunctionMaxScorer.java |
| =================================================================== |
| --- src/java/org/apache/lucene/search/DisjunctionMaxScorer.java (revision 544714) |
| +++ src/java/org/apache/lucene/search/DisjunctionMaxScorer.java (working copy) |
| @@ -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) {
|