Lucene - Core
  1. Lucene - Core
  2. LUCENE-4888

SloppyPhraseScorer calls DocsAndPositionsEnum.advance with target = -1

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      SloppyPhraseScorer calls DocsAndPositionsEnum.advance with target = -1 although the behavior of this method is undefined in such cases.

      1. LUCENE-4888.patch
        13 kB
        Adrien Grand
      2. LUCENE-4888.patch
        4 kB
        Adrien Grand

        Activity

        Hide
        Adrien Grand added a comment -

        A patch that adds assertions to AssertingDocsAndPositionsEnum. You can reproduce the issue by applying this patch and running ant test -Dtestcase=TestSloppyPhraseQuery -Dtests.codec=Asserting.

        Show
        Adrien Grand added a comment - A patch that adds assertions to AssertingDocsAndPositionsEnum. You can reproduce the issue by applying this patch and running ant test -Dtestcase=TestSloppyPhraseQuery -Dtests.codec=Asserting .
        Hide
        Adrien Grand added a comment -

        May someone confirm that the assertions I added to AssertingDocsAndPositionsEnum are correct (meaning there is actually a bug in SloppyPhraseScorer)?

        Show
        Adrien Grand added a comment - May someone confirm that the assertions I added to AssertingDocsAndPositionsEnum are correct (meaning there is actually a bug in SloppyPhraseScorer)?
        Hide
        Robert Muir added a comment -

        It looks correct to me.

        Show
        Robert Muir added a comment - It looks correct to me.
        Hide
        Adrien Grand added a comment -

        Patch that adds assertions from the previous patch to new bug fixes:

        • SloppyPhraseScorer.advance
        • MultiDocs(AndPositions)Enum.advance
        • MultiSpansWrapper.skipTo

        These three methods relied on the assumption that advance(target) is equivalent to nextDoc() when target is <= the current position (which is wrong, although all our impls behave this way).

        Show
        Adrien Grand added a comment - Patch that adds assertions from the previous patch to new bug fixes: SloppyPhraseScorer.advance MultiDocs(AndPositions)Enum.advance MultiSpansWrapper.skipTo These three methods relied on the assumption that advance(target) is equivalent to nextDoc() when target is <= the current position (which is wrong, although all our impls behave this way).
        Hide
        Adrien Grand added a comment -

        I plan to commit soon unless someone objects. I think the changes are correct but please let me know if you would like to review it as this patch modifies some touchy code (such as SloppyPhraseScorer.advance).

        Show
        Adrien Grand added a comment - I plan to commit soon unless someone objects. I think the changes are correct but please let me know if you would like to review it as this patch modifies some touchy code (such as SloppyPhraseScorer.advance).
        Hide
        Adrien Grand added a comment -

        Committed.

        Show
        Adrien Grand added a comment - Committed.

          People

          • Assignee:
            Adrien Grand
            Reporter:
            Adrien Grand
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development