algolia / algoliasearch-client-java

⚡️ A fully-featured and blazing-fast Java API client to interact with Algolia.
https://www.algolia.com/doc/api-client/getting-started/install/java/
MIT License
46 stars 33 forks source link

fix: optional filters deserialization #771

Closed aallam closed 2 years ago

aallam commented 2 years ago
Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue n/a
Need Doc update no

Describe your change

Fixes optionalFilters deserialization for following special cases:

godelized commented 2 years ago

Thanks!

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"]]

It looks like it is the legacy format: https://github.com/algolia/AlgoliaSaaS/blob/330cbefd4e3d36eba3565760a2e9ca96708c3ca4/algolia/api/json_parsers/DecodeJSONStringArray.cpp#L153-L181. If I understand correctly the first level are separate groups (i.e. conjunctions) and inside-parenthesis items are assigned to the same group (i.e.) disjunctions.

So:

To be validated with a test :smile:.

godelized commented 2 years ago

I did a pass on the tests :)


https://github.com/algolia/algoliasearch-client-java-2/pull/771/files#diff-b4728c7df2af885fb4a7070b3ce19d5902bf55c3fe38ef704f519a3ed8657beeR174-R180


https://github.com/algolia/algoliasearch-client-java-2/pull/771/files#diff-b4728c7df2af885fb4a7070b3ce19d5902bf55c3fe38ef704f519a3ed8657beeR182-R194


https://github.com/algolia/algoliasearch-client-java-2/pull/771/files#diff-b4728c7df2af885fb4a7070b3ce19d5902bf55c3fe38ef704f519a3ed8657beeR196-R204

Looks good :)

aallam commented 2 years ago
  • color:green,color:yellow

  • for the engine it is equivalent to a and: [["color:green"],["color:yellow"]]

  • ["color:green","color:yellow"]

  • for the engine it is equivalent to a and: [["color:green"],["color:yellow"]]

color:green,color:yellow and ["color:green","color:yellow"] are then equivalent! I've pushed a small changes to match the above. Thank you @godelized for your help 🙌