-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible fix to 245 issue. Using search.in query when having multiple values for the same Tag #262
Conversation
… values for the same Tag.
…o 245-filter-search-in
There's a problem with special chars allowed inside tag values, e.g. with comma For instance given this scenario: var filters = new List<MemoryFilter>
{
new MemoryFilter().ByTag("colors", "red,white"),
new MemoryFilter().ByTag("colors", "green,yellow"),
}; the old code produces this filter: # tags == 'color:red,white' OR tags == 'color:green,yellow'
(tags/any(s: s eq 'color:red,white')) or (tags/any(s: s eq 'color:green,yellow')) while the new code produces this filter which is not equivalent # tags == 'color:red' OR tags == 'white' OR tags == 'color:green' OR tags == 'yellow'
tags/any(s: search.in(s, 'color:red,white,color:green,yellow')) With |
Thanks @dluc for the testing. Let us have a look and will back to you. |
hi @dluc In the update, we are passing a different delimiter: | As per our tests, all these special chars are working fine:
and only fails if the value has the delimiter:
We have passed KM unit tests and everything worked. Let me know if you find any other issue. Thanks! |
Forgot to mention the single quote is also being escaped. |
unfortunately changing char doesn't address the problem, because Something like
(note the backslash) |
I see. Thing is that we tried some escaping actions considering all these special chars:
but we had some issues with some of them. We'll give it another try and let you know. Thanks again for your help. |
@dluc we are not able to find any escaping syntax that work fine with the search.in. I'm pretty sure the search.in function does not allow to escape the delimiter. This is what doc says about it (https://learn.microsoft.com/en-us/azure/search/search-query-odata-search-in-function):
And there is this issue on GH / SO Azure/azure-sdk-for-net#9828 As you can see, the response from a MS guy is considering a bunch of special chars, except the one passed as delimiter:
If you can find out what delimiter to use, and how to escape it, we're happy to update our code. Thanks again. |
what about a compromise?
|
There are various optimizations that can be applied, e.g. making symbol(s) configurable would be the easiest |
hey @dluc Thanks. |
There are still some bugs, I added some unit tests you can run to reproduce. Two issues in particular:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a few fixes before merge.
…o 245-filter-search-in
…mory into 245-filter-search-in
Thanks @dluc Note that I've done a change to test Hopefully all is good and we can finally merged it 😄 |
Thank you @luismanez ! |
Motivation and Context (Why the change? What's the scenario?)
Solving scenario described in issue #245
High level description (Approach, Design)
We check if there are multiple values for the same Tag, and if so, a search.in() filter is composed.