2

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://learn.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?

Jason Sypkens
  • 168
  • 1
  • 10

1 Answers1

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.

Mark B
  • 581
  • 2
  • 14
  • My concern with this approach is that the confidence scores will not be accurate when doing it this way. My assumption is that the relative confidences of the QnA Pairs would be calculated differently if their scope was available in the query; since you're changing scopes in two different queries, the relative confidences may be lost. – Jason Sypkens Jul 05 '18 at 15:05
  • It might be a better option for you to not use strictfilters currently. Making an API call normally will still return all matching questions along with their defined tags (for use in filtering after the fact), and any two answers will remain consistent in their score relative to each other. So even if they receive a smaller share due to more matching answers, they will still be ranked the same against each other. – Mark B Jul 05 '18 at 16:12