Azure 搜索 - 较小的方面计数未从索引返回
Azure Search - Smaller Facet Counts Not Returning From Index
我正在使用 Azure 搜索索引来创建产品的分面搜索。我有大约 5 个方面来帮助过滤显示的产品列表。
我注意到的一件事是,如果列出了相当多的产品以使用分面进行过滤,则属于分面的较小搜索项目不会从索引中返回。
例如(简单来说),如果我的索引在一个方面列出了以下汽车制造商:
- 奥迪(312)
- 宝马 (203)
- 沃尔沃 (198)
- 斯柯达 (4)
我发现 Skoda 不会被退回,因为与该制造商相关联的搜索结果非常少。
当我使用以下查询直接在 Azure 门户中搜索索引时,我可以看到这种情况:facet=<facet-field-name>
经过一番研究,我发现了以下内容explanation:
Facet counts can be inaccurate due to the sharding architecture. Every search index has multiple shards, and each shard reports the top N facets by document count, which is then combined into a single result. If some shards have many matching values, while others have fewer, you may find that some facet values are missing or under-counted in the results.
Although this behavior could change at any time, if you encounter this behavior today, you can work around it by artificially inflating the count: to a large number to enforce full reporting from each shard. If the value of count: is greater than or equal to the number of unique values in the field, you are guaranteed accurate results. However, when document counts are high, there is a performance penalty, so use this option judiciously.
根据上面的引述,我如何人为地增加计数来解决这个问题?或者有人知道更好的方法吗?
默认构面计数为 10。您可以使用 count
参数作为构面表达式的一部分来指定更大的计数。例如,假设您将 REST API 与 HTTP GET 请求一起使用:
facet=myfield,count:100
如果您使用的是 .NET SDK:
var parameters =
new SearchParameters()
{
Facets = new[] { "myfield,count:100" }
};
var results = indexClient.Documents.Search("*", parameters);
中找到有关构面表达式语法的更多详细信息
我正在使用 Azure 搜索索引来创建产品的分面搜索。我有大约 5 个方面来帮助过滤显示的产品列表。
我注意到的一件事是,如果列出了相当多的产品以使用分面进行过滤,则属于分面的较小搜索项目不会从索引中返回。
例如(简单来说),如果我的索引在一个方面列出了以下汽车制造商:
- 奥迪(312)
- 宝马 (203)
- 沃尔沃 (198)
- 斯柯达 (4)
我发现 Skoda 不会被退回,因为与该制造商相关联的搜索结果非常少。
当我使用以下查询直接在 Azure 门户中搜索索引时,我可以看到这种情况:facet=<facet-field-name>
经过一番研究,我发现了以下内容explanation:
Facet counts can be inaccurate due to the sharding architecture. Every search index has multiple shards, and each shard reports the top N facets by document count, which is then combined into a single result. If some shards have many matching values, while others have fewer, you may find that some facet values are missing or under-counted in the results.
Although this behavior could change at any time, if you encounter this behavior today, you can work around it by artificially inflating the count: to a large number to enforce full reporting from each shard. If the value of count: is greater than or equal to the number of unique values in the field, you are guaranteed accurate results. However, when document counts are high, there is a performance penalty, so use this option judiciously.
根据上面的引述,我如何人为地增加计数来解决这个问题?或者有人知道更好的方法吗?
默认构面计数为 10。您可以使用 count
参数作为构面表达式的一部分来指定更大的计数。例如,假设您将 REST API 与 HTTP GET 请求一起使用:
facet=myfield,count:100
如果您使用的是 .NET SDK:
var parameters =
new SearchParameters()
{
Facets = new[] { "myfield,count:100" }
};
var results = indexClient.Documents.Search("*", parameters);
中找到有关构面表达式语法的更多详细信息