SOLR“facet.prefix”未按预期工作

问题描述 投票:0回答:1

我在 solr 查询中使用facet.prefix 功能。但它似乎没有按预期工作。我的示例 solrfacet.prefix 行为“f”。 storeStockLevelSizes_string_mv.facet.prefix=123',我预计'storeStockLevelSizes'方面的响应应该只包含以186开头的数据。但我也看到了其他数据,但不是 123。 非常感谢任何帮助。

示例查询如下

yq=*:*&yab=...&q={!boost}(%2B{!lucene+v%3D$yq}+{!func+v%3D$yab})&fq=..&expand=true&expand.field=groupId_string&expand.rows=1000&
start=0&rows=36&json.facet.storeStockLevelSizes_string_mv{"type":"terms","field":"storeStockLevelSizes_string_mv","limit":-1,"mincount":1,"facet":{"groupCount":"unique(groupId_string)"},"domain":{"excludeTags":"fc"}}&json.facet.length_string_mv={"type":"terms","field":"length_string_mv","limit":100,"mincount":1,"facet":{"groupCount":"unique(groupId_string)"},"domain":{"excludeTags":"fc"}}&
json.facet.waist_string_mv={"type":"terms","field":"waist_string_mv","limit":100,"mincount":1,"facet":{"groupCount":"unique(groupId_string)"},"domain":{"excludeTags":"fc"}}&
facet.limit=500&
f.storeStockLevelSizes_string_mv.facet.limit=-1&
f.storeStockLevelSizes_string_mv.facet.prefix=123&
fl=score,code_string&wt=xml

响应应仅包含“storeStockLevelSizes”方面以 123 开头的方面值。但我也看到了其他价值观。我的SOLR版本是8.11.3

solr solrj solrcloud solr-query-syntax
1个回答
0
投票

JSONFacet 就位后,我们需要在 JSON Facet 本身中使用前缀和限制值,如下所示

json.facet.storeStockLevelSizes_string_mv={"type":"terms","field":"storeStockLevelSizes_string_mv","limit":-1,"mincount":1,"domain":{"excludeTags":"fc"},"prefix":"123"}&

f.storeStockLevelSizes_string_mv.facet.prefix=123 适用于基于传统 Facet API 的查询创建,但不适用于最新版本的 JSONFacet API。

将 solr 方面字段添加到 solrquery 时,我们需要确保也添加前缀作为参数之一。该实现不适用于开箱即用的类 (FacetSearchQueryFacetsPopulator)。要么重写该类并添加实现,要么找到其他方法来拦截并添加前缀片段。

© www.soinside.com 2019 - 2024. All rights reserved.