In addition to search, we also need to provide sorting options on an e-commerce website. By default, the search results are ordered by the relevancy score that has been computed on the basis of the boosting we have provided. However, there would still be requirements to sort the search results by other factors such as
latest products. Sorting by already known fields is simple. All we need to do is add the sorting criteria behind our Solr search query:
Alternatively, add the following sorting code:
The intelligence that needs to be built into the system here is sorting by relevance after
price. This is to take care of scenarios where the ordered results may contain irrelevant results in the ...