knoxpo / dart_algolia

[Unofficial] Algolia is a pure dart SDK, wrapped around Algolia REST API for easy implementation for your Flutter or Dart projects.
Other
117 stars 112 forks source link

Fix tagFilters implementation, adding tagFilters with OR relations #117

Open quaaantumdev opened 1 year ago

quaaantumdev commented 1 year ago

The current tagFilters implementation does not support OR relations, and it has implementation errors which should throw errors, but luckily dart/flutter does not throw (yet). This PR fixes both.

The bug fixed: _paramters['tagFilters'] is created as a List<List> and is cast to a List. Interestingly, this does not throw currently, but I guess there is no guarantee it will not throw one day.

The Feature added: Allow for a combination of AND and OR Tag filters such as: tag1 AND (tag2 OR tag3) AND (tag4 OR tag5) AND tag6 this is created by defining tagFilters like this:

{
  "tag1",
  [ "tag2", "tag3" ],
  [ "tag4", "tag5" ],
  "tag6"
}

would love to see this merged, thanks :)

happy if somebody wants to add some docs above but didn't take the time as most other functions do not have serious docs anyway

quaaantumdev commented 4 months ago

@nhathiwala would really like to see this merged :)