meilisearch-swift
meilisearch-swift copied to clipboard
Filters are supposed to be a String.
On the Swift documentation of
https://docs.meilisearch.com/reference/features/filtering_and_faceted_search.html#using-facets, it is described to use filter attributes as an array. However, pasting that exact code in the Xcode produces an error which states:
Cannot convert value of type '[[String]]' to expected argument type 'String?'
let searchParameters = SearchParameters(
query: "thriller",
filter: [["genres = Horror", "genres = Mystery"], ["director = \"Jordan Peele\""]])
The bug comes on Xcode 13.2 Using SPM Meilisearch Version 0.12.0
Hello @ravisharmaa, thanks for the report! I moved the issue to the meilisearch-swift repo so that the maintainer (@bidoubiwa) can help you with your problem!
Hey @ravisharmaa Thanks for raising this error :) This will need to be fixed here asap
Indeed you can also create filters in a string format.
For example:
(genres = horror OR genres = comedy) AND release_date > 795484800
@bidoubiwa Thank you for the prompt response.
Hey @ravisharmaa Thanks for raising this error :) This will need to be fixed here asap
Indeed you can also create filters in a string format.
For example:
(genres = horror OR genres = comedy) AND release_date > 795484800
@bidoubiwa This means array support for filters is wip or a typo in the documentation?
@ravisharmaa Array support is not required since you can translate your filter into a string that Meilisearch can understand. It's more simple. :) It's just the documentation that is outdated. Thank you for the report.
@bidoubiwa This means array support for filters is wip or a typo in the documentation?
It is a mistake in the documentation!
@bidoubiwa Thank you for clearing it out. You can resolve the issue at your ease or shall I close this issue?
We keep it open until we did not fix the issue. The sample is on this repo here.
Feel free to contribute to fix it! No problem if you don't have time :)
I'm going to close this since, some of SDKs will not be able to support string filters or array filters (we can't ensure that)