apache / apache/lucene

Unknown query type SynonymQuery in ComplexPhraseQueryParser for boolean clauses [LUCENE-9377]

Open
#10,417 0 comments 0 reactions 0 assignees View on GitHub
affects-version:8.4 legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Follow up for #8746.

ComplexPhraseQueryParser fails with

```java
Unknown query type:org.apache.lucene.search.SynonymQuery
```

exception on queries like name: "(dog cat) something" if dog expands by SynonymFilter.

For now parser converts to BooleanQuery only top-level SynonymQueries, but not the nested ones.

Looks like it can be fixed by simple conversion in BQ clauses handling loop similar to #8746.

---
Migrated from [LUCENE-9377](https://issues.apache.org/jira/browse/LUCENE-9377) by Nikolay Khitrin (@khitrin)
Attachments: [LUCENE-9377.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-9377/LUCENE-9377.patch)

Contributor guide

Open the contributing guide

Research direction

Start in ComplexPhraseQueryParser and inspect its BooleanQuery clauses handling loop, comparing the nested handling with the top-level SynonymQuery conversion described in the issue and #8746. Reproduce the query name: "(dog cat) something" with dog expanded by SynonymFilter, then verify that nested SynonymQuery clauses no longer produce the unknown-query-type exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.