[ https://issues.apache.org/jira/browse/LUCENE-9005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16952979#comment-16952979 ]
ASF subversion and git services commented on LUCENE-9005: --------------------------------------------------------- Commit c19845775520108dce35feabfc081f606b34584f in lucene-solr's branch refs/heads/branch_8_3 from Alan Woodward [ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=c198457 ] LUCENE-9005: BooleanQuery.visit() pulls subvisitors from a top-level MUST visitor > BooleanQuery.visit() incorrectly pulls subvisitors from its parent > ------------------------------------------------------------------ > > Key: LUCENE-9005 > URL: https://issues.apache.org/jira/browse/LUCENE-9005 > Project: Lucene - Core > Issue Type: Bug > Reporter: Alan Woodward > Assignee: Alan Woodward > Priority: Major > Attachments: LUCENE-9005.patch > > > BooleanQuery.visit() calls getSubVisitor once for each of its clause sets; > however, this sub visitor is called on the passed-in visitor, which means > that sub clauses get attached to its parent, rather than a visitor for that > particular BQ. > To illustrate, consider the following nested BooleanQuery: ("a b" (+c +d %e > f)); we have a top-level disjunction query containing one phrase query > (essentially a conjunction), and one boolean query containing both MUST, > FILTER and SHOULD clauses. When visiting, the top level query will pull a > SHOULD subvisitor, and pass both queries into it. The phrase query will pull > a MUST subvisitor and all its two terms. The nested boolean will pull a > MUST, and FILTER and a SHOULD; but these are all attached to the parent > SHOULD visitor - in particular, the MUST and FILTER clauses will end up being > attached to this SHOULD visitor, and be mis-interpreted as a disjunction. > To fix this, BQ should first pull a MUST visitor and visit its MUST clauses > using this visitor; SHOULD, FILTER and MUST_NOT clauses should then be pulled > from this top-level MUST visitor. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org