meilisearch / meilisearch-swift

Swift client for the Meilisearch API
https://www.meilisearch.com
MIT License
92 stars 27 forks source link

Filters are supposed to be a String. #246

Closed ravisharmaa closed 1 year ago

ravisharmaa commented 2 years ago

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

curquiza commented 2 years ago

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!

bidoubiwa commented 2 years ago

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
ravisharmaa commented 2 years ago

@bidoubiwa Thank you for the prompt response.

ravisharmaa commented 2 years ago

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?

ppamorim commented 2 years ago

@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 commented 2 years ago

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

It is a mistake in the documentation!

ravisharmaa commented 2 years ago

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

bidoubiwa commented 2 years ago

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

brunoocasali commented 1 year ago

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)