Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8005

when some docs have no values, sorting on field(multivalued_field,min/max) has inconsistent ordering compared to sorting on same effective values in a single valued field



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.4
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      While working on tests for SOLR-8001 i realized that because the multivalued min/max selector function (ie: field(multivalued_field_name,min) produces a ValueSource which is a SortedSetFieldSource instance, and because SortedSetFieldSource uses SortedSetSortField when sorting, then in situations where some documents do not have any value at all in the multivalued field the sort order will be inconsistent compared to sorting on a single valued numeric field containing the same "effective" min/max value (where docs w/o a value act as if the value is "0" by default).

      ie: sort=min_of_multivalued_field_name+asc vs sort=field(multivalued_field_name,min)+asc will not sort identically.

      I don't have any immediate ideas for a "fix" to make these situations more equivilent, but the current known workarround for people that want equivilent behavior is to wrap the field function in a def function selecting a default value of 0 – ie: sort=def(field(multivalued_field_name,min))+asc.

      If the function is already wrapped in some other numeric function, then the behavior (combined with the existing bug fix in SOLR-8001) should already be equivilent – ie: sort=sum(32,min_of_multivalued_field_name)+asc vs sort=sum(32,field(multivalued_field_name,min))+asc


          Issue Links



              • Assignee:
                hossman Chris M. Hostetter
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: