sort the solr search result. give error can not sort on multivalued field: name

Viewed 777

I am newer to the Apache Solr search.

I am trying to sort the result set in the Solr query. Query : name:abc* AND hidden:false & sort=name desc

It's showing the error : can not sort on the multivalued field: name

Solr version is: 7.2.1

1 Answers

If you’re using recent versions of the Solr (>5.3) you should be able to use min or max functions to do sorting on multivalued fileds like this:

sort=field(field_to_sort_on,min) asc

The only requirement to achieve this is to use DocValues on this field - so finding minimum/maximum on multivalued field could be achieved efficiently

Related