meilisearch-swift icon indicating copy to clipboard operation
meilisearch-swift copied to clipboard

Filters are supposed to be a String.

Open ravisharmaa opened this issue 2 years ago • 8 comments

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

ravisharmaa avatar Dec 15 '21 03:12 ravisharmaa

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!

curquiza avatar Dec 15 '21 09:12 curquiza

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 avatar Dec 15 '21 10:12 bidoubiwa

@bidoubiwa Thank you for the prompt response.

ravisharmaa avatar Dec 15 '21 11:12 ravisharmaa

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 avatar Dec 15 '21 11:12 ravisharmaa

@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.

ppamorim avatar Dec 15 '21 11:12 ppamorim

@bidoubiwa This means array support for filters is wip or a typo in the documentation?

It is a mistake in the documentation!

bidoubiwa avatar Dec 15 '21 12:12 bidoubiwa

@bidoubiwa Thank you for clearing it out. You can resolve the issue at your ease or shall I close this issue?

ravisharmaa avatar Dec 15 '21 12:12 ravisharmaa

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 :)

bidoubiwa avatar Dec 15 '21 12:12 bidoubiwa

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)

brunoocasali avatar Aug 14 '23 23:08 brunoocasali