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

Sorting on FloatFiled or FloatPoint producing erroneous results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 5.3.1
    • None
    • core/search
    • None
    • New

    Description

      When we use FloatField for sorting, decimal values are getting rounded off and results is erroneous. Even after upgrading version to 6.0.0 FloatPoint results are also erroneous. We are getting correct results only when we use field as FloatDocValues.

      I have attached a sample project which can show case the bug which i encountered LuenceSortFloatIssue.zip

      I debugged to see what happened internally, below are few things which i encountered.

      I used the following values to sort 12.5,15,0,0,12. We can clearly see 12.5 and 12 are saved as 1.7E-44 in queue.

      when we use `FloatDocValuesField` to store the value then the sorting is working as expected. we can see values are stored without rounding off in below image

      Only difference i see in the file Lucene50DocValuesProducer . In case of floatPoint numeric entry format is CONST_COMPRESSED and for rest of field types like int point, long point or FloatDocValuesField the entry format is TABLE_COMPRESSED.

       

       

      Attachments

        1. FloatDocValuesStored.png
          39 kB
          SAILENDRA PAVAN
        2. FloatFieldStored.png
          54 kB
          SAILENDRA PAVAN
        3. Lucene50DocValuesProducer.png
          392 kB
          SAILENDRA PAVAN
        4. LuenceSortFloatIssue.zip
          16 kB
          SAILENDRA PAVAN
        5. screenshot-1.png
          272 kB
          SAILENDRA PAVAN

        Activity

          People

            Unassigned Unassigned
            Sailendra SAILENDRA PAVAN
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: