Solr复杂的刻面(Solr complicated faceting)

编程入门 行业动态 更新时间:2024-10-23 19:34:16
Solr复杂的刻面(Solr complicated faceting)

我有刻面问题。 想象一下这种情况。 产品可以在多个类别中。 这是分面的常见行为:

类别

Android(25) iPhone(55) 其他(25)

现在,当我选择“Android”时,我使用“fq”=>“category:Android”进行新查询,我会得到:

类别

Android的 iPhone(15) 其他(2)

但这意味着有15种产品,分别是“Android”和“iPhone”。 我想要这样的东西:(“Android”或“iPhone”)

类别

Android的 iPhone(+5) 其他(+1)

意思是通过选择“Android(25)”获得25个结果,选择“iPhone(+5)”获得另外5个,最后我将得到30个搜索结果。

有没有人知道SOLR的分面是否可行? 或者可能有多个查询并手动计算?

谢谢你的建议!

I have problems with faceting. Imagine this situation. Product can be in more than one category. This is common behavior for faceting:

Category

Android (25) iPhone (55) other (25)

Now when I select "Android", I make new query with "fq" => "category:Android", I will get:

Category

Android iPhone (15) other (2)

But this means that there is 15 products, that are in categories "Android" AND "iPhone". I would like something like this: ("Android" OR "iPhone")

Category

Android iPhone (+5) other (+1)

Meaning I will get 25 results by selecting "Android (25)" and another 5 by selecting "iPhone (+5)", so finally I will get 30 search results..

Does anyone know if this is possible with SOLR's faceting? Or perhaps with more than one query and calculate it manually?

Thanks for advice!

最满意答案

尝试使用选项否定的新查询,例如"fq" => "-category:Android" - 然后您应该获得您正在寻找的方面计数。

Try a new query with the negative of the selections, like "fq" => "-category:Android" - you should then get the facet counts you are looking for.

更多推荐

本文发布于:2023-07-15 19:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117542.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Solr   complicated   faceting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!