You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Alexey Panchenko <al...@olmisoft.com> on 2004/12/01 07:03:43 UTC

Patch to BooleanScorer

Hello !

This patch fixes loosing of first matching document when BooleanQuery
with BooleanClause.Occur.SHOULD is added to another BooleanQuery.

Index: src/java/org/apache/lucene/search/BooleanScorer.java
===================================================================
RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/BooleanScorer.java,v
retrieving revision 1.13
diff -u -u -U5 -r1.13 BooleanScorer.java
--- src/java/org/apache/lucene/search/BooleanScorer.java        13 Oct 2004 17:12:04 -0000      1.13
+++ src/java/org/apache/lucene/search/BooleanScorer.java        1 Dec 2004 05:52:48 -0000
@@ -131,17 +131,17 @@
   public boolean next() throws IOException {
     boolean more;
     do {
       while (bucketTable.first != null) {         // more queued
         current = bucketTable.first;
-        bucketTable.first = current.next;         // pop the queue
 
         // check prohibited & required
         if ((current.bits & prohibitedMask) == 0 && 
             (current.bits & requiredMask) == requiredMask) {
           return true;
         }
+        bucketTable.first = current.next;         // pop the queue
       }
 
       // refill the queue
       more = false;
       end += BucketTable.SIZE;


Test case is attached.

-- 
Best regards,
 Alexey                          mailto:alex+news@olmisoft.com