本文介绍了从天蓝色搜索中获取所有`Facets`,而没有商品结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我目前遇到的是azure cognitive search的性能问题.

Hi all I'm facing performance issues with azure cognitive search currently I have 956 Facets filed.

当我从Azure服务器加载Documents时,大约需要30到35秒.

When I load Documents from Azure server it's taking almost 30 to 35 seconds.

但是当我从Azure搜索请求中删除Facets时,在2到3秒钟内就会加载Documents.

But when I remove Facets from Azure search request Documents load in 2 to 3 seconds.

为此,我创建了2个API

So for this, I have created 2 API's

  1. Azure服务器的第一个API加载文档结果.
  2. 第二个API从azure服务器加载所有Facets.

有什么办法只能加载Facets吗?

Is there any way to load only Facets?

DocumentSearchResult<AzureSearchItem> results = null;
ISearchFilterResult searchResult = DependencyResolver.Current.GetService<ISearchFilterResult>();
WriteToFile("Initiate request call for search result ProcessAzureSearch {0}");
results = searchServiceClient.Documents.Search<AzureSearchItem>(searchWord, parameters);
WriteToFile("Response received for search result {0}");

推荐答案

Faceting是一项对匹配结果执行的聚合操作,当存在许多不同的存储桶时,该操作非常费力.我无法评论延迟的具体增加,但在查询中添加构面肯定会对性能产生影响.

Faceting is an aggregation operation that's performed over the matching results and is quite intensive when there are a lot of distinct buckets. I can't comment on the specific increase in latency but adding facets to the query definitely has a performance impact.

由于分面计算匹配文档上的汇总,因此必须在后端运行查询,但正如Gaurav所述,指定top = 0将阻止实际检索,因为它不需要包含在响应中.这可以提高性能,尤其是在单个文档很大的情况下.

Since faceting computes aggregation on matching documents, it has to run the query in the backend but as Gaurav mentioned, specifying top = 0 will prevent the actual retrieval as it doesn't need to be included in the response. This could improve the performance especially if the individual docs are large.

另一种可能性是先只运行查询,然后使用标识符字段来过滤带有构面的文档.由于筛选比查询快,因此总延迟应有所改善.仅当您能够从第一个API调用中识别生成的文档的ID组时,此方法才有效.

Another possibility is to run just the query first and then use a identifier field to filter the docs with facets. Since filtering is faster than querying, the overall latency should improve. This only works if you're able to identify the id groups for the resultant docs from the 1st API call.

通常,如果需要在具有高基数的字段上运行构面查询,通常建议谨慎使用构面,并重新评估设计.这是有关优化搜索效果的文档,您可以查看- https://docs.microsoft.com/en-us/azure/search/search-performance-optimization

In general I'd recommend using facets judiciously and re-evaluate the design if there is a need to run faceting queries on a field with high cardinality. Here's a document on optimizing search performance that you can take a look at -https://docs.microsoft.com/en-us/azure/search/search-performance-optimization

这篇关于从天蓝色搜索中获取所有`Facets`,而没有商品结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 12:10