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

PhraseQuery incorrectly advertises it supports terms at the same position

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      The following in PhraseQuery has been here since Sept 15th 2004 (by "goller"):

          /**
           * Adds a term to the end of the query phrase.
           * The relative position of the term within the phrase is specified explicitly.
           * This allows e.g. phrases with more than one term at the same position
           * or phrases with gaps (e.g. in connection with stopwords).
           * 
           */
          public Builder add(Term term, int position) {
      

      Of course this isn't true; it's why we have MultiPhraseQuery. Yet we even allow you to have consecutive terms with the same positions. We shouldn't allow that; we should throw an exception. For my own sanity, I modified a simple MultiPhraseQuery test to use PhraseQuery instead and of course it didn't work.

        Attachments

        1. LUCENE_6801.patch
          11 kB
          David Smiley
        2. LUCENE_6801.patch
          6 kB
          David Smiley

          Activity

            People

            • Assignee:
              dsmiley David Smiley
              Reporter:
              dsmiley David Smiley
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: