过滤 solr 方面计数
给定以下场景:
<field name="product_id" type="text" indexed="true" stored="true" multivalued="true"/>
<field name="product_type" type="text" indexed="true" stored="true" multivalued="true"/>
我想获取给定结果集的按特定product_type过滤的facet字段product_id的facet计数(为了得到这个我使用过滤器查询等...)
请注意,我想要的是过滤facet计数:
分面查询没有帮助,因为它引入了包含特定分面查询结果的列表。 (过滤器查询也不行)
2921
Facet.prefix 做了我想要的那种过滤器,但我不知道如何在这种情况下使用它。
请注意,我想过滤掉与特定类别匹配的 ProductID 计数
<lst name="facet_fields">
<lst name="productID">
<int name="xHidyhuVZIUVVMfUJM8zd6">209</int>
<int name="34YFQf0F9kqP29SQgrmqI1">206</int>
<int name="m3wp9GS9Iweai0ftKLSlG">195</int>
<int name="aAwN5QFjQLxcrDWFiirjY2">169</int>
<int name="k405yG1RwRndI5T19dMO8">169</int>
</lst>
</lst>
Given the following scenario:
<field name="product_id" type="text" indexed="true" stored="true" multivalued="true"/>
<field name="product_type" type="text" indexed="true" stored="true" multivalued="true"/>
i want to get facet counts for the facet field product_id filtered by specific product_type given a resultset (to get this i use filter query etc ...)
Note that what i want is to filter facet counts so:
Facet query does'nt help due to it introduce a list with the results, of the specific facet queries. (nor filter query does)
2921
Facet.prefix does the kind of filter that i want, but i don't know how to use it in this scenario.
Remark that i want to filter counting off productID that matches specific category
<lst name="facet_fields">
<lst name="productID">
<int name="xHidyhuVZIUVVMfUJM8zd6">209</int>
<int name="34YFQf0F9kqP29SQgrmqI1">206</int>
<int name="m3wp9GS9Iweai0ftKLSlG">195</int>
<int name="aAwN5QFjQLxcrDWFiirjY2">169</int>
<int name="k405yG1RwRndI5T19dMO8">169</int>
</lst>
</lst>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,您无法使用其他字段来过滤构面计数。 facet.prefix 仅在您正在分面的同一字段上运行。
我会发出另一个查询来过滤产品类型,只是为了获取您想要的方面计数,例如:
select?q=product_type:somecategory&rows=0&facet=true&facet.field=product_id
As far as I know you can't filter a facet count using another field. facet.prefix only operates on the same field that you're faceting.
I would issue another query that filters the product type, just to get the facet count you want, something like:
select?q=product_type:somecategory&rows=0&facet=true&facet.field=product_id