Closed willshelley closed 1 year ago
Hi @willshelley,
Thank you for the issue. I'm transferring this to the integration guides repo as this is related to a missing Swift code sample(geosearch_guide_filter_usage_3
). This code sample should have been added as part of https://github.com/meilisearch/integration-guides/issues/254
Hi @willshelley, usually, when there is no code sample in the documentation, there is no implementation of that feature.
But I believe that in this case, is just a missing code sample. Can you try this?
let searchParameters = SearchParameters(
filter: '_geoBoundingBox([45.494181, 9.179175], [45.449484, 9.214024])'
)
client.index("restaurants").search(searchParameters) { (result: Result<Searchable<Restaurant>, Swift.Error>) in
switch result {
case .success(let searchResult):
print(searchResult)
case .failure(let error):
print(error)
}
}
Hi @brunoocasali , thanks for the quick reply. Realised I had our coordinates mixed up 😬, all worked as expected.
let searchParameters = SearchParameters(
query: "",
filter: "_geoBoundingBox([45.494181, 9.179175], [45.449484, 9.214024])"
)
client.index("restaurants").search(searchParameters) { (result: Result<Searchable<Restaurant>, Swift.Error>) in
switch result {
case .success(let searchResult):
print(searchResult)
case .failure(let error):
print(error)
}
}
Amazing, good to know! 🎉
We were trying to implement _geoBoundingBox filter after successfully implementing _geoRadius sort. We couldn't find any documentation for swift and currently can't get it to work. Understand that that should be an issue for the iOS-sdk.