1

We have a specific requirement of sorting the products as per a specific attribute value sequence. Any pointer or source of info would help us.

Example of the scenario;

Let's say for search result I want to sort results based on a attribute producttype. Where producttype has following values:

A, B, C, D

so while in Solr query I can give either producttype asc, producttype desc.

But I want get result in a specific way by saying first give me All results of values 'C' then B, A, D.

We are using Solr with IBM wcs7.

cheffe
  • 9,345
  • 2
  • 46
  • 57
Santosh Sidnal
  • 128
  • 1
  • 9
  • possible duplicate http://stackoverflow.com/questions/19813548/is-it-possible-in-solr-to-specify-an-ordering-of-documents/19830551 – cheffe Apr 02 '14 at 07:59

1 Answers1

2

I recommend you to take a look on this article - http://sujitpal.blogspot.ru/2011/05/custom-sorting-in-solr-using-external.html or sorting by FunctionQuery - http://wiki.apache.org/solr/FunctionQuery#Sort_By_Function

UPD. Also, one possible solution is add term query with boosting, e.g.

*:* OR type:A^100 OR type:B^200 OR type:C^2

So, it will be boosted in needed way. All you need to do, is play with boosting weight a little bit

Mysterion
  • 9,050
  • 3
  • 30
  • 52