Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 71144 invoked from network); 19 Mar 2010 23:38:49 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Mar 2010 23:38:49 -0000 Received: (qmail 5162 invoked by uid 500); 19 Mar 2010 23:38:48 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 5097 invoked by uid 500); 19 Mar 2010 23:38:48 -0000 Mailing-List: contact java-dev-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-dev@lucene.apache.org Received: (qmail 5068 invoked by uid 99); 19 Mar 2010 23:38:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Mar 2010 23:38:48 +0000 X-ASF-Spam-Status: No, hits=-1076.2 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Mar 2010 23:38:47 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 53ED5234C4AE for ; Fri, 19 Mar 2010 23:38:27 +0000 (UTC) Message-ID: <1769546592.378651269041907342.JavaMail.jira@brutus.apache.org> Date: Fri, 19 Mar 2010 23:38:27 +0000 (UTC) From: "Gary Yngve (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Created: (LUCENE-2336) off by one: DisjunctionSumScorer::advance MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 off by one: DisjunctionSumScorer::advance ----------------------------------------- Key: LUCENE-2336 URL: https://issues.apache.org/jira/browse/LUCENE-2336 Project: Lucene - Java Issue Type: Bug Components: Search Reporter: Gary Yngve Priority: Minor The bug is: if (target <= currentDoc) { should be if (target < currentDoc) { based on the comments for the method as well as the contract for DocIdSetIterator: "Advances to the first beyond the current" It can be demonstrated by: assertEquals("advance(1) first match failed", 1, scorer.advance(1)); assertEquals("advance(1) second match failed", n, scorer.advance(1)); if docId: 1 is a hit and n is the next hit. (Tests all pass if this code change is made.) I'm not labeling it as major because the class is package-protected and currently passes spec. Relevant excerpt: /** * Advances to the first match beyond the current whose document number is * greater than or equal to a given target.
* When this method is used the {@link #explain(int)} method should not be * used.
* The implementation uses the skipTo() method on the subscorers. * * @param target * The target document number. * @return the document whose number is greater than or equal to the given * target, or -1 if none exist. */ public int advance(int target) throws IOException { if (scorerDocQueue.size() < minimumNrMatchers) { return currentDoc = NO_MORE_DOCS; } if (target <= currentDoc) { return currentDoc; } do { if (scorerDocQueue.topDoc() >= target) { boolean b = advanceAfterCurrent(); return b ? currentDoc : (currentDoc = NO_MORE_DOCS); } else if (!scorerDocQueue.topSkipToAndAdjustElsePop(target)) { if (scorerDocQueue.size() < minimumNrMatchers) { return currentDoc = NO_MORE_DOCS; } } } while (true); } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org