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

Wildcards, ORs etc inside Phrase queries

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 4.8
    • Component/s: core/queryparser
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      An extension to the default QueryParser that overrides the parsing of PhraseQueries to allow more complex syntax e.g. wildcards in phrase queries.

      The implementation feels a little hacky - this is arguably better handled in QueryParser itself. This works as a proof of concept for much of the query parser syntax. Examples from the Junit test include:

      checkMatches("\"j* smyth~\"", "1,2"); //wildcards and fuzzies are OK in phrases
      checkMatches("\"(jo* -john) smith\"", "2"); // boolean logic works
      checkMatches("\"jo* smith\"~2", "1,2,3"); // position logic works.

      checkBadQuery("\"jo* id:1 smith\""); //mixing fields in a phrase is bad
      checkBadQuery("\"jo* \"smith\" \""); //phrases inside phrases is bad
      checkBadQuery("\"jo* [sma TO smZ]\" \""); //range queries inside phrases not supported

      Code plus Junit test to follow...

        Attachments

        1. LUCENE-1486.patch
          6 kB
          Ahmet Arslan
        2. LUCENE-1486.patch
          6 kB
          Tomas Eduardo Fernandez Lobbe
        3. LUCENE-1486.patch
          43 kB
          Mark Miller
        4. Lucene-1486 non default field.patch
          1 kB
          Mark Hobson
        5. junit_complex_phrase_qp_07_22_2009.patch
          1 kB
          Luis Alves
        6. junit_complex_phrase_qp_07_21_2009.patch
          8 kB
          Adriano Crestani
        7. LUCENE-1486.patch
          21 kB
          Mark Miller
        8. LUCENE-1486.patch
          21 kB
          Mark Miller
        9. LUCENE-1486.patch
          19 kB
          Mark Hobson
        10. LUCENE-1486.patch
          18 kB
          Mark Miller
        11. TestComplexPhraseQuery.java
          5 kB
          Mark Hobson
        12. ComplexPhraseQueryParser.java
          12 kB
          Mark Hobson

          Issue Links

            Activity

              People

              • Assignee:
                erickerickson Erick Erickson
                Reporter:
                markh Mark Hobson
              • Votes:
                13 Vote for this issue
                Watchers:
                21 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: