lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Panchenko <alex+n...@olmisoft.com>
Subject Patch to BooleanScorer
Date Wed, 01 Dec 2004 06:03:43 GMT
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
Mime
View raw message