亚马逊喜欢在 solm 中进行精细过滤

Amazon like refined filtering in solr

我们需要像亚马逊一样实现下钻搜索。

如果选择了任何供应商, 目前它禁用了其余供应商作为 solr facet only returns 选择的过滤器。 查询:supplier:supplierId

虽然上面的查询返回多个 Screen Color/Screen Size,但在进一步选择时,每个过滤器部分只返回所选元素。

任何帮助使其像 Amazon.com 的精细过滤一样工作的人将不胜感激。

要提供多select分面,需要对涉及的过滤器进行标记,以便在对应字段分面时排除。这可以使用 tagex local parameters 来实现。

Solr 参考指南 - Tagging and Excluding Filters :

To implement a multi-select facet for a given field, a GUI may want to still display the other field values and their associated counts, as if the corresponding filter constraint had not yet been applied.

To return counts for the field values that are currently not selected, tag filters that directly constrain the field, and exclude those filters when faceting on it.

例如,对于最初看起来像这样的查询:

q=mainquery&fq=supplier:supplierId&facet=true&facet.field=supplier

您将执行以下操作:

q=mainquery&fq={!tag=sup}supplier:supplierId&facet=true&facet.field={!ex=sup}supplier