Solr上的排序未按预期工作

时间:2016-12-09 09:27:41

标签: solr

我尝试按productType排序,但似乎无法正常工作。

在插入SOLR之前,我已经对查询进行了排序。

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:2)

可以对文档进行排序,前提是文档字段是非标记化的(即:没有分析器)或使用仅生成单个术语的分析器(即:使用KeywordTokenizer)

它应该multiValued="false" indexed="true"

检查分析仪的字段productType

为您的字段solr.TextField将类从solr.StrField更改为productTye可能有所帮助。

答案 1 :(得分: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.