Lucene - Core
  1. Lucene - Core
  2. LUCENE-4504

Empty results from IndexSearcher.searchAfter() when sorting by FunctionValues

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.3, 6.0
    • Component/s: modules/other
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      IS.searchAfter() always returns an empty result when using FunctionValues for sorting.

      The culprit is ValueSourceComparator.compareDocToValue() returning -1 when it should return +1.

      1. LUCENE-4504.patch
        5 kB
        Robert Muir
      2. LUCENE-4504.patch
        0.5 kB
        TomShally
      3. Lucene4504Test.java
        3 kB
        TomShally

        Issue Links

          Activity

          Hide
          TomShally added a comment -

          Patch against trunk

          Show
          TomShally added a comment - Patch against trunk
          Hide
          Michael McCandless added a comment -

          That's definitely a bug, and the fix looks good (though are we sure the first if shouldn't return 1?).

          Do you have a test showing the bug/fix? Thanks.

          Show
          Michael McCandless added a comment - That's definitely a bug, and the fix looks good (though are we sure the first if shouldn't return 1?). Do you have a test showing the bug/fix? Thanks.
          Hide
          TomShally added a comment -

          Attached test fails with trunk, passes with patch.

          are we sure the first if shouldn't return 1?

          According to the javadocs and test: yes. It's supposed to compare the candidate (doc, docValue) against the "after" value (valueObj, value) and return -1 if the candidate is less than the provided after value.

          Show
          TomShally added a comment - Attached test fails with trunk, passes with patch. are we sure the first if shouldn't return 1? According to the javadocs and test: yes. It's supposed to compare the candidate (doc, docValue) against the "after" value (valueObj, value) and return -1 if the candidate is less than the provided after value.
          Hide
          Robert Muir added a comment -

          Thanks for the test Tom!

          I rolled both these into a combined patch: I'll commit soon.

          Show
          Robert Muir added a comment - Thanks for the test Tom! I rolled both these into a combined patch: I'll commit soon.
          Hide
          Robert Muir added a comment -

          Thanks again Tom!

          Show
          Robert Muir added a comment - Thanks again Tom!
          Hide
          Robert Muir added a comment -

          While adding more assertions to the tests, i noticed i somehow screwed up the backport here... this bugfix and test were never backported to 4.1.

          Show
          Robert Muir added a comment - While adding more assertions to the tests, i noticed i somehow screwed up the backport here... this bugfix and test were never backported to 4.1.
          Hide
          Uwe Schindler added a comment -

          Closed after release.

          Show
          Uwe Schindler added a comment - Closed after release.

            People

            • Assignee:
              Unassigned
              Reporter:
              TomShally
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development