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

Allow single prefix "phrase*" in complexphrase queryparser

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: master (7.0), 6.4
    • Component/s: core/queryparser
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      From Otmar Caduff <ocad...@gmail.com>
      Subject ComplexPhraseQueryParser with wildcards
      Date Tue, 20 Dec 2016 13:55:42 GMT
      Hi,

      I have an index with a single document with a field "field" and textual
      content "johnny peters" and I am using
      org.apache.lucene.queryparser.complexPhrase.ComplexPhraseQueryParser to
      parse the query:
      field: (john* peter)
      When searching with this query, I am getting the document as expected.
      However with this query:
      field: ("john*" "peter")
      I am getting the following exception:
      Exception in thread "main" java.lang.IllegalArgumentException: Unknown
      query type "org.apache.lucene.search.PrefixQuery" found in phrase query
      string "john*"
      at
      org.apache.lucene.queryparser.complexPhrase.ComplexPhraseQueryParser$ComplexPhraseQuery.rewrite(ComplexPhraseQueryParser.java:268)

      1. LUCENE-7614.patch
        2 kB
        Mikhail Khludnev
      2. LUCENE-7614.patch
        2 kB
        Mikhail Khludnev

        Issue Links

          Activity

          Hide
          mkhludnev Mikhail Khludnev added a comment -

          Colleagues, can you have a look at a few rows in LUCENE-7614.patch? I really want in shovel it in 6.4.

          Show
          mkhludnev Mikhail Khludnev added a comment - Colleagues, can you have a look at a few rows in LUCENE-7614.patch ? I really want in shovel it in 6.4.
          Hide
          mikemccand Michael McCandless added a comment -

          Maybe check for MultiTermQuery instead of separately for Wildcard,Prefix,TermRangeQuery?

          Do you want to include PointRangeQuery too (not sure this QP ever parses that)? It's not a MultiTermQuery so you'd need to also check for it, if so.

          Show
          mikemccand Michael McCandless added a comment - Maybe check for MultiTermQuery instead of separately for Wildcard,Prefix,TermRangeQuery ? Do you want to include PointRangeQuery too (not sure this QP ever parses that)? It's not a MultiTermQuery so you'd need to also check for it, if so.
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          Thanks, Michael McCandless. Attaching LUCENE-7614.patch with the applied suggestion. I suppose we can tackle points later then.

          Show
          mkhludnev Mikhail Khludnev added a comment - Thanks, Michael McCandless . Attaching LUCENE-7614.patch with the applied suggestion. I suppose we can tackle points later then.
          Hide
          mikemccand Michael McCandless added a comment -

          +1

          Show
          mikemccand Michael McCandless added a comment - +1
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 52f2a77b78fc95bc98d664411cda63d58606df52 in lucene-solr's branch refs/heads/master from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=52f2a77 ]

          LUCENE-7614: ComplexPhraseQueryParser ignores quotes around single terms phrases

          Show
          jira-bot ASF subversion and git services added a comment - Commit 52f2a77b78fc95bc98d664411cda63d58606df52 in lucene-solr's branch refs/heads/master from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=52f2a77 ] LUCENE-7614 : ComplexPhraseQueryParser ignores quotes around single terms phrases
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit ac85a41cbefa7b0ea8c1b0b5c3ec9584d318a1cb in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=ac85a41 ]

          LUCENE-7614: ComplexPhraseQueryParser ignores quotes around single terms phrases

          Show
          jira-bot ASF subversion and git services added a comment - Commit ac85a41cbefa7b0ea8c1b0b5c3ec9584d318a1cb in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=ac85a41 ] LUCENE-7614 : ComplexPhraseQueryParser ignores quotes around single terms phrases

            People

            • Assignee:
              Unassigned
              Reporter:
              mkhludnev Mikhail Khludnev
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development