Solr Range Facets dynamically modifying the ranges based on the search query

三世轮回 提交于 2020-07-09 11:48:25

问题


So here is what I am trying to do. I have a facet defined on the price field.

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) 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.

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.

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.


回答1:


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.



来源:https://stackoverflow.com/questions/33179596/solr-range-facets-dynamically-modifying-the-ranges-based-on-the-search-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!