问题
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"?
https://docs.microsoft.com/sl-si/azure/cognitive-services/qnamaker/how-to/metadata-generateanswer-usage
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?
回答1:
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" }]
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.
来源:https://stackoverflow.com/questions/50977134/using-multiple-strictfilters-in-qna-maker