Search code examples
sortingsolrsolr-query-syntax

Adding filter query to Sort alone in Solr


We just want to apply filter query to sort alone. is there any way to do that in solr? As we apply group query, we can't provide fq parameter directly.

Main issue: we are sorting by price field. Price is available for two categories. While grouping it should consider both categories but while sorting, only one category should be considered.By using copy field, we copied the price of that category to new field, but since other category's price field has empty values, it is displayed at top. Which is not expected.

Please let me know if further details required.


Solution

  • Add the attribute sortMissingLast="true" to the field definition that has the missing values and reindex.

    Here's a link that matches your use case exactly.