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

Incorrect sort by Numeric values for documents missing the sorting field

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Lucene Fields:
      Patch Available

      Description

      While sorting results over a numeric field, documents which do not contain a value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested against Double, Float, Int & Long numeric fields ascending and descending order).
      This behavior is unexpected, as zero is "comparable" to the rest of the values. A better solution would either be allowing the user to define such a "non-value" default, or always bring those document results as the last ones.

      Example scenario:
      Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any value.
      Searching with MatchAllDocsQuery, with sort over that field in descending order yields the docid results of 0, 2, 1.

      Asking for the top 2 documents brings the document without any value as the 2nd result - which seems as a bug?

        Attachments

        1. SortByDouble.java
          2 kB
          Gilad Barkai
        2. LUCENE-3390-inverted.patch
          12 kB
          Uwe Schindler
        3. LUCENE-3390-fix-like-trunk.patch
          13 kB
          Uwe Schindler
        4. LUCENE-3390-fix-like-trunk.patch
          19 kB
          Uwe Schindler
        5. LUCENE-3390-fix-like-trunk.patch
          19 kB
          Uwe Schindler
        6. LUCENE-3390-fix-like-trunk.patch
          22 kB
          Uwe Schindler
        7. LUCENE-3390-BitsInterface.patch
          24 kB
          Uwe Schindler
        8. LUCENE-3390-BitsInterface.patch
          26 kB
          Doron Cohen
        9. LUCENE-3390-BitsInterface.patch
          29 kB
          Uwe Schindler
        10. LUCENE-3390.patch
          23 kB
          Doron Cohen

        Issue Links

          Activity

            People

            • Assignee:
              uschindler Uwe Schindler
              Reporter:
              giladbarkai Gilad Barkai

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment