solr - 过滤 solr 方面计数

标签 solr faceted-search

给定以下场景:

<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 计数(为此,我使用过滤器查询等...)

请注意,我想要的是过滤分面计数:

  • 方面查询没有帮助,因为它引入了一个包含特定方面查询结果的列表。 (过滤器查询也没有)

    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>

最佳答案

据我所知,您不能使用另一个字段来过滤构面计数。 facet.prefix 仅在您要分面的同一字段上运行。

我会发出另一个查询来过滤产品类型,只是为了获得您想要的方面计数,例如:select?q=product_type:somecategory&rows=0&facet=true&facet.field=product_id

关于solr - 过滤 solr 方面计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/847288/

相关文章:

django - 根据页面不同,SearchQuerySet 也不同

Solr 完全重新索引,无需停机

SOLR - 在模式中使用单个文本字段进行全文搜索

solr - 在 SOLR 中过滤和分面多值字段

algorithm - 分面搜索的算法是什么?

Solr - 获取构面计数而不返回搜索结果

mysql - JRuby on Rails 和 Solr 索引

solr - 如何使用 Solrnet 返回搜索结果分数

php - Solr PHP 客户端与 file_get_contents?

elasticsearch - 过滤器中的汇总仅在所有过滤的文档中都存在时才返回值?