如何在Solr结果中获取构面范围? [英] How to get facet ranges in solr results?

查看:64
本文介绍了如何在Solr结果中获取构面范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在Solr中的文档有一个名为 price 的字段,并且该字段具有多面性.我想将构面作为值的范围(例如:0-100、100-500、500-1000等).怎么做?

Assume that I have a field called price for the documents in Solr and I have that field faceted. I want to get the facets as ranges of values (eg: 0-100, 100-500, 500-1000, etc). How to do it?

我可以预先指定范围,但是我还想知道是否可以根据文档中的值自动计算范围(例如5个值)?

I can specify the ranges beforehand, but I also want to know whether it is possible to calculate the ranges (say for 5 values) automatically based on the values in the documents?

推荐答案

要回答第一个问题,您可以使用通用构面查询支持来获取构面范围. 这里的示例:

To answer your first question, you can get facet ranges by using the the generic facet query support. Here's an example:

http://localhost:8983/solr/select?q=video&rows=0&facet=true&facet.query=price:[*+TO+500]&facet.query=price:[500+TO+*]

关于第二个问题(自动提示构面范围),该问题尚未实现.有人认为,这种查询最好在您的应用程序上实现,而不是让Solr猜测"最佳方面.

As for your second question (automatically suggesting facet ranges), that's not yet implemented. Some argue that this kind of querying would be best implemented on your application rather that letting Solr "guess" the best facet ranges.

以下是关于该主题的一些讨论:

Here are some discussions on the topic:

  • (Archived) https://web.archive.org/web/20100416235126/http://old.nabble.com/Re:-faceted-browsing-p3753053.html
  • (Archived) https://web.archive.org/web/20090430160232/http://www.nabble.com/Re:-Sorting-p6803791.html
  • (Archived) https://web.archive.org/web/20090504020754/http://www.nabble.com/Dynamically-calculated-range-facet-td11314725.html

这篇关于如何在Solr结果中获取构面范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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