Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift _geoBoundingBox implementation is missing #387

Closed
willshelley opened this issue Jun 13, 2023 · 4 comments
Closed

Swift _geoBoundingBox implementation is missing #387

willshelley opened this issue Jun 13, 2023 · 4 comments
Labels
question Further information is requested

Comments

@willshelley
Copy link

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.

@maryamsulemani97
Copy link

maryamsulemani97 commented Jun 13, 2023

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 meilisearch/integration-guides#254

@maryamsulemani97 maryamsulemani97 transferred this issue from meilisearch/documentation Jun 13, 2023
@brunoocasali brunoocasali transferred this issue from meilisearch/integration-guides Jun 13, 2023
@brunoocasali
Copy link
Member

brunoocasali commented Jun 13, 2023

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

@brunoocasali brunoocasali added the question Further information is requested label Jun 13, 2023
@willshelley
Copy link
Author

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

@brunoocasali
Copy link
Member

Amazing, good to know! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants