按多个字符串中的任意一个查询/筛选 Azure 搜索 Edm.Collection

Query / Filter Azure Search Edm.Collection by any of multiple strings

如果集合中有多个字符串中的任何一个,我正在尝试将 azure 搜索 edm.collection 过滤为 return 结果。我只能在查询一项时让它工作,这对我的用例来说还不够好。我找不到查询多个参数的语法。

filter += "FirmTypes / any (x: x eq 'Big 4')";

以上工作和return公司类型为 Big 4 的所有文件。

我尝试了多种方法(下面的一些)来过滤多个参数但没有成功

//filter += " OR any (x: x eq 'Industry')";
//filter += "FirmTypes / any (x: x eq 'Industry')";
//filter += "FirmTypes / any (x: x eq 'Big 4', 'Industry', 'PLC')"
//filter += "FirmTypes / any (x: x eq 'Big 4' or 'Industry' or 'PLC')"
//filter += "FirmTypes / any (x: x eq 'Big 4') or (x: x eq 'Industry')"
//filter += "FirmTypes / any (x: x eq 'Big 4')|(x: x eq 'Industry')"

任何人都可以指出我正确的方向吗?提前谢谢你。

一发帖就收到了。如果其他人有同样的问题

"FirmTypes / any (x: x eq 'Big 4') or FirmTypes / any (x: x eq 'Industry')"

过滤多个值的最佳方法是使用新的 search.in 函数:

FirmTypes/any(x: search.in(x, 'Big 4|Industry', '|'))

对于大量的值,search.in 比使用 oreq 的组合要快得多,而且它可以处理更多的值而不会遇到困难过滤器复杂性的限制。