Sort Solr Search Result

1 comment
Below snippet will help you to sort solr search results.

Few things i would like to highlight about solr result sorting.
You can not sort tokenized field i mean if you have defined your solr field with the type text or textToTight.
You can sort the field which have type string . You can create dynamic fields easily in solr.
Add below entry in schema.xml and solr will automatically create field with the type string.

<dynamicField name="*_sortable" type="string" indexed="true" multiValued="false" stored="true" />

If you use any field with suffix _sortable then solr will automatically create field if it is not exist.

Next PostNewer Post Previous PostOlder Post Home

1 comment:

  1. I have used this code ans still solr is not hitting with sorted field what I passed in search Context.
    Please note my code as below,