Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-58898

Range numeric queries do not work with Solr

    Details

      Description

      STEPS TO REPRODUCE
      1.- Create a Web content structure with an Integer field
      2.- Create several Web content articles with the previous structure and set different numeric values for each article. For example: 1, 2, 10, ...
      3.- Deploy solr4-web and reindex the contents in the portal
      4.- Go to the Solr admin page > collection1 > Query and in the q field, place different queries like the following ones, changing the range (substitue appropietly the ddm field name to the one you are using):

      +(ddm/30712/Integer1692_en_US_Number_sortable:[1 TO 2]) 
      +(ddm/30712/Integer1692_en_US_Number_sortable:[0 TO 10]) 
      +(ddm/30712/Integer1692_en_US_Number_sortable:[1 TO 10]) 
      

      ACTUAL
      The results include some not expected numeric values to the ones in the range query

      EXPECTED
      The results should be restricted to the values set in the range query

      EXPLANATION
      The numeric fields used in the schema.xml provided in the solr-web plugin allow the results to be ordered but not to apply range queries.
      For the sortable fields, it's used:

      <fieldType class="solr.DoubleField" name="double" omitNorms="true" />
      [...]
      <dynamicField indexed="true" multiValued="false" name="*Number_sortable" stored="true" type="double" />	
      

      As it is said in http://lucene.apache.org/solr/4_3_1/solr-core/org/apache/solr/schema/DoubleField.html ,

      Field values will sort numerically, but Range Queries (and other features that rely on numeric ranges) will not work as expected: values will be evaluated in unicode String order, not numeric order.

      If numeric ranges need to work for some fields, it should use solr.TrieDoubleField or SortableDoubleField (deprecated)

        Attachments

          Activity

            People

            Assignee:
            tibor.lipusz Tibor Lipusz
            Reporter:
            sergio.sanchez Sergio Sanchez
            Participants of an Issue:
            Recent user:
            Enterprise Release HU
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              5 years, 4 weeks, 5 days ago

                Packages

                Version Package
                6.2.3 CE GA4
                6.2.10 EE GA1