Azure 搜索 - 如何实现多方面搜索?

Azure search - how to implement multiple facet search?

例如,如果我们有类别分面并且它 returns 具有 5 个不同的类别,则在单击第一个类别时,其他类别将不会在响应中可用。我想实现多方面搜索。 感谢您的回复。

有关更多信息,我指的是与以下相同的场景: https://feedback.azure.com/forums/263029-azure-search/suggestions/7762452-provide-multiselect-facets

如果您想过滤具有多个方面的结果,您可以按如下方式修改您的过滤器:

$filter = search.in(country, 'USA,Canada,Mexico,Brasil,Chile,Argentina', ',')

The first parameter to the search.in function is the string field reference (or a range variable over a string collection field in the case where search.in is used inside an any or all expression). The second parameter is a string containing the list of values, separated by spaces and/or commas. If you need to use separators other than spaces and commas because your values include those characters, you can specify an optional third parameter to search.in. This third parameter is a string where each character of the string, or subset of this string is treated as a separator when parsing the list of values in the second parameter.

有关 Azure 搜索中过滤器和排序子句的 OData 表达式语法的详细信息,请参阅此 tutorial

响应中的方面仅限于所选内容,不支持此功能。我建议在这里投票 https://feedback.azure.com/forums/263029-azure-search/suggestions/7762452-provide-multiselect-facets

解决方法是发送多个查询以分别获取构面和筛选结果。

例如, 1. 在第一个搜索查询之后将所有方面保留在 UI 中(或进行另一个查询以获取所有方面); 2. 如果应用程序跟踪用户选择的方面,则在选择另一个方面后进行另一个搜索查询。