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

ComplexPhraseQueryParser throws ParseException for fielded queries

    XMLWordPrintableJSON

Details

    • New, Patch Available

    Description

      Queries using QueryParser's non-default field e.g.
      author:"j* smith" are not supported by ComplexPhraseQueryParser. For example following code snippet

      ComplexPhraseQueryParser qp = new ComplexPhraseQueryParser(TEST_VERSION_CURRENT, "defaultField", new MockAnalyzer(new Random()));
            qp.parse("author:\"fred* smith\"") ;
      

      yields

      Caused by: org.apache.lucene.queryparser.classic.ParseException: Cannot have clause for field "defaultField" nested in phrase  for field "author"
      	at org.apache.lucene.queryparser.complexPhrase.ComplexPhraseQueryParser.checkPhraseClauseIsForSameField(ComplexPhraseQueryParser.java:147)
      	at org.apache.lucene.queryparser.complexPhrase.ComplexPhraseQueryParser.newTermQuery(ComplexPhraseQueryParser.java:135)
      	... 49 more
      

      Attachments

        1. LUCENE-5530.patch
          5 kB
          Ahmet Arslan
        2. LUCENE-5530.patch
          5 kB
          Ahmet Arslan

        Activity

          People

            erickerickson Erick Erickson
            iorixxx Ahmet Arslan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: