0

I tried sorting by productType but it seems to be not working properly.

I already have sort on query before inserting to SOLR.

enter image description here

enter image description here

Eleven
  • 339
  • 2
  • 6
  • 20

2 Answers2

2

Sorting can be done on the documents provided that document field is either non-tokenized (ie: has no Analyzer) or uses an Analyzer that only produces a single Term (ie: uses the KeywordTokenizer)

And it should multiValued="false" indexed="true"

check you analyzer for the field productType

changing class from solr.TextField to solr.StrField for you field productTye might help.

Vinod
  • 1,965
  • 1
  • 9
  • 18
0

Many questions are asked on multi-value sort on solr, and same problem I was also face.

I solved my problem with the help of @PrabhuVelayutham answer on this link.

He is saying.
"Create a copyfield to copy the content of multivalued data into a sorted concatenated single value without commas and use it for sorting.

For Ex :

Doc 1 :

multiValuedData : 11, 78, 45, 22

sortedConcatenatedSingleValue : 11224578

Doc 2 :

multiValuedData : 56, 74, 62, 10

sortedConcatenatedSingleValue : 10566274 "

You can go throw it and surly, you will get your result.

Community
  • 1
  • 1
vijay
  • 731
  • 5
  • 15
  • Just be aware that you might want to pad your numbers if they're of differing lengths. This is also not the problem that the question related to, as the question has trouble with sorting by a text field, where the tokens are split into separat values as part of how a text field is handled. Vinod's answer is the correct answer. – MatsLindh Dec 10 '16 at 18:28