raghavyadav01 opened a new pull request, #16118:
URL: https://github.com/apache/pinot/pull/16118
Fix AND/OR behavior in Lucene query parsing and enable wildcard support for
all query parsers
The Lucene query parser was incorrectly handling AND/OR operations when
converting to span queries. Specifically:
1. OR operations (using `BooleanClause.Occur.SHOULD`) were being converted
to `SpanNearQuery` instead of `SpanOrQuery`
2. Wildcard support was not consistently enabled across all query parser
types
Changes
1. Fixed AND/OR behavior in `LuceneTextIndexUtils`:
- OR operations now correctly use `SpanOrQuery`
- AND operations continue to use `SpanNearQuery`
- Added proper handling of `BooleanClause.Occur` types (MUST for AND,
SHOULD for OR)
2. Enhanced query parser support:
- Enabled `setAllowLeadingWildcard(true)` for all parser types
- Added comprehensive tests for each parser type
3. Added test coverage:
- Tests for OR queries with wildcards
- Tests for AND queries with wildcards
- Tests for mixed wildcard and term queries
- Tests for single wildcard queries
- Tests for queries without wildcards
## Testing
Added comprehensive test cases in `LuceneTextIndexUtilsTest` and
`LuceneTest`:
- OR queries: `power OR *free`, `power* OR *free`
- AND queries: `power AND *free`
- NOT queries: `power NOT free`, `power NOT *free`
- Wildcard queries: `*power`, `power*`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]