apache / apache/lucene

QueryParser changes OR clausule to AND [LUCENE-7483]

Open
#8,535 4 comments 0 reactions 0 assignees View on GitHub
affects-version:6.2.1 legacy-jira-priority:Minor module:core/queryparser type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

QueryParser incorrectly parses the expression `t1 AND t2 *OR* t3 AND t4` as
`(+t1 +t2 +t3 +t4)` while `t1 AND t2 AND t3 AND t4` produces the same result.

The expected result for expression `t1 AND t2 OR t3 AND t4` is `(+t1 +t2) (+t3 +t4)`.

This occurs using StandardQueryParser or classic.QueryParser.

---
Migrated from [LUCENE-7483](https://issues.apache.org/jira/browse/LUCENE-7483) by Júlio César e Melo

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the expressions with StandardQueryParser and classic.QueryParser, comparing the current parsed output with the expected grouped Boolean clauses. Trace how mixed AND and OR operators are handled in both entry points, then verify that each parser preserves the two AND groups joined by OR.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.