Solr使用Collapse and Expand时Facet计数不正确如何解决
Solr Collapse功能Facet计数异常问题
问题表现
使用Collapse and Expand Results功能时,Solr返回的Facet计数存在错误:正确计数应为numFound对应的1212,但实际返回的是分组后的值102。
复现问题的请求如下:
https://localhost/solr/index/select?q=*:* &fq={!collapse+field%3Dcode_string} &fq={!tag%3Dfk1}week_int:17 &expand=true &expand.rows=100 &facet.field={!ex%3Dfk1}week_int &facet=true &facet.sort=count &facet.mincount=1 &facet.limit=5000
已尝试的无效排查方案
- 切换为Grouping功能可正常得到结果,对应配置为
group.field=code_string&group.main=true,但Collapse and Expand性能更优,优先希望用该功能实现同等效果。 - 配置
fq={!collapse+field%3Dcode_string}搭配facet.field={!ex=collapse}week_int:仅返回fq中指定的week_int:17对应的分面值,无法返回其他分面值。 - 配置
collapse.facet=facet.before|facet.after参数,未达到预期效果。 - 改用JSON Facet查询,同样无法返回fq过滤条件外的其他分面值,对应请求如下:
https://localhost/solr/index/select?q=*:* &fq={!collapse field=code_string} &fq={!tag=fk2}week_int:17 &expand=true &json.facet={ week_int: { type: terms, field: week_int, facet: { workCount: "unique(code_string)" }, domain: { excludeTags: [code_string] } } }
诉求
需要找到配置方案,在使用Collapse功能时,获取到未应用collapse时的正确Facet计数及全部分面值。
内容的提问来源于stack exchange,提问作者raveendra_bikkina
相关产品推荐
相关产品推荐

