Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8495

ComplexPhraseQuery.rewrite throws "Unknown query type:org.apache.lucene.search.SynonymQuery" when nested BooleanQuery contains a SynonymQuery

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.4, 8.0
    • Fix Version/s: None
    • Component/s: core/queryparser
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      When using nested queries in ComplexPhrases, and a part of the query is a SynonymQuery, an exception is thrown from  addComplexPhraseClause:

      throw new IllegalArgumentException("Unknown query type:"
      {{ + childQuery.getClass().getName());}}

      Examples (dogs and tv are synonyms):

      "(cats OR dogs) cigar"

      "platform* (video* OR tv)"~10

      The bug is similar in nature to LUCENE-8305, in that SynonymQuery support was added to ComplexPhraseQueryParser (in LUCENE-7695), but was not expanded to nested queries.

      The fix is similar to the one in LUCENE-8305, namely to add the same logic in addComplexPhraseClause as in rewrite.

      See attached patch.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bjarkebm2 Bjarke Mortensen
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: