From commits-return-102547-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Tue Jul 31 04:32:19 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A0728180630 for ; Tue, 31 Jul 2018 04:32:18 +0200 (CEST) Received: (qmail 55757 invoked by uid 500); 31 Jul 2018 02:32:17 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 55748 invoked by uid 99); 31 Jul 2018 02:32:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2018 02:32:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 82889DFC43; Tue, 31 Jul 2018 02:32:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: datcm@apache.org To: commits@lucene.apache.org Date: Tue, 31 Jul 2018 02:32:17 -0000 Message-Id: <245098a3c85b4f1d9cbf1029423fd355@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/36] lucene-solr:jira/http2: LUCENE-8427: Fix bug in BlockMaxConjunctionScorer. Repository: lucene-solr Updated Branches: refs/heads/jira/http2 7a045d16e -> 8b208776e LUCENE-8427: Fix bug in BlockMaxConjunctionScorer. In case a scorer would return information about a block that doesn't contain any matches, BlockMaxConjunctionScorer could use invalid score bounds. This would never occur when building a conjunction of term queries but possibly when building a conjunction of phrase queries for instance. Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/65f6e6c1 Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/65f6e6c1 Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/65f6e6c1 Branch: refs/heads/jira/http2 Commit: 65f6e6c1501b3fd075ca586dd9bd49850514d234 Parents: 35fa0b4 Author: Adrien Grand Authored: Wed Jul 25 10:57:11 2018 +0200 Committer: Adrien Grand Committed: Wed Jul 25 10:57:11 2018 +0200 ---------------------------------------------------------------------- .../lucene/search/BlockMaxConjunctionScorer.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/65f6e6c1/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java ---------------------------------------------------------------------- diff --git a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java index bb5d99c..cbfcd2e 100644 --- a/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java +++ b/lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionScorer.java @@ -145,6 +145,20 @@ final class BlockMaxConjunctionScorer extends Scorer { return NO_MORE_DOCS; } + if (doc > upTo) { + // This check is useful when scorers return information about blocks + // that do not actually have any matches. Otherwise `doc` will always + // be in the current block already since it is always the result of + // lead.advance(advanceTarget(some_doc_id)) + final int nextTarget = advanceTarget(doc); + if (nextTarget != doc) { + doc = lead.advance(nextTarget); + continue; + } + } + + assert doc <= upTo; + if (minScore > 0) { score = leadScorer.score(); if (score < minScores[0]) {