Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 86124 invoked from network); 22 Jul 2005 01:48:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Jul 2005 01:48:38 -0000 Received: (qmail 85760 invoked by uid 500); 22 Jul 2005 01:48:38 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 85742 invoked by uid 500); 22 Jul 2005 01:48:37 -0000 Mailing-List: contact java-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-commits@lucene.apache.org Received: (qmail 85729 invoked by uid 99); 22 Jul 2005 01:48:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jul 2005 18:48:37 -0700 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 21 Jul 2005 18:48:33 -0700 Received: (qmail 86119 invoked by uid 65534); 22 Jul 2005 01:48:36 -0000 Message-ID: <20050722014836.86117.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r220228 - /lucene/java/trunk/src/java/org/apache/lucene/search/BooleanScorer2.java Date: Fri, 22 Jul 2005 01:48:36 -0000 To: java-commits@lucene.apache.org From: ehatcher@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ehatcher Date: Thu Jul 21 18:48:32 2005 New Revision: 220228 URL: http://svn.apache.org/viewcvs?rev=220228&view=rev Log: #35823 - Paul Elschots fix for BooleanScorer2 causing ArrayIndexOutOfBoundsException Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanScorer2.java Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanScorer2.java URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/BooleanScorer2.java?rev=220228&r1=220227&r2=220228&view=diff ============================================================================== --- lucene/java/trunk/src/java/org/apache/lucene/search/BooleanScorer2.java (original) +++ lucene/java/trunk/src/java/org/apache/lucene/search/BooleanScorer2.java Thu Jul 21 18:48:32 2005 @@ -99,12 +99,17 @@ /** Count a scorer as a single match. */ private class SingleMatchScorer extends Scorer { private Scorer scorer; + private int lastScoredDoc = -1; + SingleMatchScorer(Scorer scorer) { super(scorer.getSimilarity()); this.scorer = scorer; } public float score() throws IOException { - coordinator.nrMatchers++; + if (doc() > lastScoredDoc) { + lastScoredDoc = doc(); + coordinator.nrMatchers++; + } return scorer.score(); } public int doc() { @@ -125,8 +130,12 @@ // each scorer from the list counted as a single matcher { return new DisjunctionSumScorer(scorers) { + private int lastScoredDoc = -1; public float score() throws IOException { - coordinator.nrMatchers += nrMatchers; + if (doc() > lastScoredDoc) { + lastScoredDoc = doc(); + coordinator.nrMatchers += super.nrMatchers; + } return super.score(); } }; @@ -139,8 +148,13 @@ { final int requiredNrMatchers = requiredScorers.size(); ConjunctionScorer cs = new ConjunctionScorer(defaultSimilarity) { + private int lastScoredDoc = -1; + public float score() throws IOException { - coordinator.nrMatchers += requiredNrMatchers; + if (doc() > lastScoredDoc) { + lastScoredDoc = doc(); + coordinator.nrMatchers += requiredNrMatchers; + } // All scorers match, so defaultSimilarity super.score() always has 1 as // the coordination factor. // Therefore the sum of the scores of the requiredScorers