Sandesh Dumbre
Sandesh Dumbre

Reputation: 236

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

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

Upvotes: 3

Views: 1175

Answers (1)

Mysterion
Mysterion

Reputation: 9320

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

Upvotes: 1

Related Questions