-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix: optional filters deserialization #771
Conversation
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.
thanks for the fix!
I am not sure about the behavior of single string filter.
👋🏻 @godelized do you remember how "color:green,color:yellow"
should be translated? is it [["color:green"],["color:yellow"]]
algoliasearch-core/src/test/java/com/algolia/search/JacksonParserTest.java
Outdated
Show resolved
Hide resolved
algoliasearch-core/src/test/java/com/algolia/search/JacksonParserTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Antoine Hémery <antoine.hemery@algolia.com>
Thanks!
It looks like it is the legacy format: So:
To be validated with a test 😄. |
I did a pass on the tests :)
Looks good :) |
|
algoliasearch-core/src/test/java/com/algolia/search/JacksonParserTest.java
Show resolved
Hide resolved
2a00803
to
6015b3e
Compare
...liasearch-core/src/main/java/com/algolia/search/models/indexing/FiltersJsonDeserializer.java
Outdated
Show resolved
Hide resolved
4240bf2
to
54c8b60
Compare
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.
thanks for the patch @aallam, we now cover all the use-cases. :)
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.
Let's go 🚀.
The only concern I have is that if a client sends a weird filter string like (((A:1),B:2),(C:3),D:4)
, the engine is going to accept it (but the behavior is not correct imo). However when fetching it with the Java client, it will convert it to something different.
But I guess it's an edge case of something that is already a bug so its fine 👍.
…718) | Q | A | ----------------- | ---------- | Bug fix? | yes | New feature? | no | BC breaks? | no | Need Doc update | no ## Describe your change One-string legacy filter deserialization behavior is fixed to handle parenthesis usage with multiple groups. Added more tests to cover possible usages. **PS:** This behavior is already fixed in other client libraries. This implementation is based on those PRs which are fixing the same issue. algolia/algoliasearch-client-java#771 algolia/algoliasearch-client-csharp#803 ## What problem is this fixing? When legacy one-string filters are used deserialization was not working as expected. Normally, it should work as below; ``` "color:green,color:yellow" => [["color:green"],["color:yellow"]] "(color:green,color:yellow),color:blue" => [["color:green","color:yellow"], ["color:blue"]] "(color:green,color:yellow)" => [["color:green","color:yellow"]] ```
Describe your change
Fixes
optionalFilters
deserialization for following special cases:["A:1", "B:2"]
->[["A:1"], ["B:2"]]
"A:1", "B:2"
->[["A:1"], ["B:2"]]