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

Wildcards, ORs etc inside Phrase queries

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4
    • 4.8
    • core/queryparser
    • None
    • 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. ComplexPhraseQueryParser.java
          12 kB
          Mark Harwood
        2. TestComplexPhraseQuery.java
          5 kB
          Mark Harwood
        3. LUCENE-1486.patch
          18 kB
          Mark Miller
        4. LUCENE-1486.patch
          19 kB
          Mark Harwood
        5. LUCENE-1486.patch
          21 kB
          Mark Miller
        6. LUCENE-1486.patch
          21 kB
          Mark Miller
        7. junit_complex_phrase_qp_07_21_2009.patch
          8 kB
          Adriano Crestani
        8. junit_complex_phrase_qp_07_22_2009.patch
          1 kB
          Luis Alves
        9. Lucene-1486 non default field.patch
          1 kB
          Mark Harwood
        10. LUCENE-1486.patch
          43 kB
          Mark Miller
        11. LUCENE-1486.patch
          6 kB
          Tomas Eduardo Fernandez Lobbe
        12. LUCENE-1486.patch
          6 kB
          Ahmet Arslan

        Issue Links

          Activity

            People

              erickerickson Erick Erickson
              mharwood Mark Harwood
              Votes:
              13 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: