问题描述
这就是我正在尝试做的.我在价格字段上定义了一个方面.
So here is what I am trying to do.I have a facet defined on the price field.
1)当查询"wordA"时我希望各个方面介于0-1000之间,分为5个间隔,因为"wordA"的最高价格永远不会超过1000
1) When there is a query for "wordA"I want the facets to be from 0-1000 divided in 5 intervals since my maximum price for "wordA" will never exceed 1000
2)当查询"wordB"时我希望将方面从0-50分为5个间隔,因为查询"wordB"的最高价格永远不会超过50.
2) When there is a query for "wordB"I want the facets to be from 0-50 divided in 5 intervals since my maximum price for the query "wordB" will never exceed 50.
因此,基本上,我希望构面范围能够动态变化,以使查询"wordB"的最终匹配范围不会在0-1000范围内,而所有匹配均位于第1个范围内.
So basically I want the facet range to change dynamically so that I don't end up with a range of 0-1000 for a query "wordB" where all the hits will lie in the 1st range.
如果solr不支持此功能,那么根据返回的结果来修改范围将涉及大量查询后处理.
If solr does not support this then it will be a lot of query post processing involved to modify the ranges based on the returned results.
推荐答案
Solr不支持此功能,但是您可以通过执行两个查询来自己完成操作-第一个获取该字段的统计信息(最大值,最小值),然后提交查询构面范围(间隔).
Solr does not support that, but you can do it yourself by doing two queries - first get the stats (max, min) for the field, then submit a query for the facet ranges (intervals) that are suitable for your application.
这篇关于Solr Range Facets根据搜索查询动态修改范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!