我试图通过在Solrconfig文件中更改以下内容,在Solr中对类型为date的ABC和类型为text的XYZ两个不同的字段应用排序:
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="invariants">
<str name="sort">ABC desc</str>
<str name="sort">XYZ desc</str>
</lst>我希望按照ABC字段排序,但如果任何记录有相同的日期,排序应该是按照XYZ字段。根据我的代码,我得到的结果只有ABC字段。
发布于 2015-03-26 19:58:51
在Solr's reference documentation and there the part about sorting中,您可以读取
- When more than one sort criteria is provided, the second entry will only be used if the first entry results in a tie. If there is a third entry, it will only be used if the first AND second entries are tied. This pattern continues with further entries.
但是您已经为该字段传递了两个单独的参数,因此请尝试按照说明进行传递,并用逗号分隔它们
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="invariants">
<str name="sort">ABC desc,XYZ desc</str>
</lst>https://stackoverflow.com/questions/29271523
复制相似问题