apache / apache/lucene

QueryParser parsing a phrase with a wildcard

Open
#14,440 1 comment 0 reactions 0 assignees View on GitHub
type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

Hi all,

I have tried to parse this query using the classic QueryParser:

String sQuery = "\"foo bar*\"";

The query was parsed into a PhraseQuery with two terms: "foo" and "bar". That is the wildcard was lost and the query doesn't handle the "bar" term as a prefix.

I think this is an issue: Lucene should either produce an error, if wildcard search isn't supported within phrases, or it should produce a correct query.

### Version and environment details

10.1.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the classic QueryParser behavior from the issue with the query "\"foo bar*\"" on Lucene 10.1.0, then inspect the parser and query construction path for phrase wildcards. Done means the wildcard is either rejected with a clear error or preserved in a query that treats "bar*" as a prefix.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.