问题描述
我希望使用Microsoft QnA Maker的StrictFilter函数来传入多个严格的过滤器,但要将它们视为filterA或filterB.似乎严格过滤器被视为filterA AND filterB.有什么办法可以将它们更改为或"吗?
I'm looking to use the StrictFilter function of Microsoft QnA Maker, to pass in multiple strict filters, but to treat them as filterA OR filterB. It appears that the strict filters are treated as filterA AND filterB. Is there any way to change them to "OR"?
看起来最终它是在查询Azure搜索,生成一个"filterA AND filterB"-是否直接查询Azure Search而不是GenerateAnswer方法是其他人采用这种方法的一种方法?
It looks like ultimately it's querying Azure search, generating an "filterA AND filterB" - would querying Azure Search directly rather than the GenerateAnswer method be an approach anyone else has taken for something like this?
推荐答案
因此,在这种情况下,当前无法在同一API调用中将过滤器进行AND操作.但是,通过使用不同的严格过滤器多次发布相同的查询,然后将它们添加在一起,可以得到类似的效果.
So in this case ANDing filters together within the same API call is not currently possible. However you can get a similar effect by posting the same query multiple times with different strict filters and then adding them together.
Call1: "strictFilters": [ { "name": "filter1", "value": "value1" },{ "name": "filter2", "value": "value2" }]
Call2: "strictFilters": [ { "name": "filter1", "value": "value1" },{ "name": "filter2", "value": "value3" }]
这将返回filter1设置为value1且filter2设置为value2或value3的所有条目. 文档如果不再需要此解决方法,则可能会进行更新.
This would return all entries with filter1 set to value1 and filter2 set to value2 or value3. The documentation will likely be updated if this workaround is no longer necessary.
这篇关于在QnA Maker中使用多个StrictFilters的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!