SORL构面字段按降序排序 [英] SORL facet fields order by descending value

查看:90
本文介绍了SORL构面字段按降序排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将SOLR 6.5.1与方面过滤器一起使用. 我的查询有:

I am using SOLR 6.5.1 with facet filters. My query has:

facet.limit = -1->生成所有可能的构面值

facet.limit=-1 --> to generate all possible facets values

facet.sort = index->​​可以按出现次数而不是其itef值对构面值进行排序

facet.sort=index --> to order facets values not by number of occurrences but by the value itsef

例如,一个方面具有整数作为值(特别是字段包含年份).因此值是(出现在方括号中):

For instance, one facet has integers as values (in particular the fields contains years). So the values are (occurences in brackets):

2010(438)

2011(547)

...

2017(367)

该构面按值正确排序,但按升序排列(2010-> 2017).如何获得逆序(2017-> 2010)?

The facet is correctly ordered by value but with asc order (2010-->2017). How can obtaint the reverse order (2017-->2010)?

谢谢

UMG

推荐答案

您将无法使用简单的facet API(直接在URL中使用的旧API)指定排序方向.但是,由于要检索所有可能的方面,因此可以在输出值之前在客户端控制器中反转方向.确切的操作方式取决于您使用的语言.

You won't be able to specify the sort direction with the simple facet API (the old one used directly in the URL). But since you're retrieving all the possible facets, you can reverse the direction in your client side controller before outputting the values. Exactly how you do that depends on which language you're using.

但是,如果您要切换到基于JSON的更现代的方面API ,您可以直接在构面的每个级别上指定排序顺序:

But if you'd switch over to the more modern JSON-based facet API, you can specify the sort order directly on each level of the facet:

"sort":"index desc"

指定如何对生产的桶进行分类. 计数"指定文档计数,索引"按存储桶值的索引(自然)顺序排序.您还可以按存储桶中发生的任何方面功能/统计信息进行排序.默认值为"count desc".此参数也可以在JSON中指定,例如sort:{count:desc}.排序顺序可以是"asc"或"desc"

Specifies how to sort the buckets produced. "count" specifies document count, "index" sorts by the index (natural) order of the bucket value. One can also sort by any facet function / statistic that occurs in the bucket. The default is "count desc". This parameter may also be specified in JSON like sort:{count:desc}. The sort order may either be "asc" or "desc"

这篇关于SORL构面字段按降序排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆