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

Sorting by field #34

Closed
cerupcat opened this issue May 14, 2018 · 1 comment
Closed

Sorting by field #34

cerupcat opened this issue May 14, 2018 · 1 comment

Comments

@cerupcat
Copy link

Is there an example of how to sort by a field? For example, sort by rating or sort by distance, etc. I can't seem to find an example.

@spinach
Copy link
Contributor

spinach commented May 16, 2018

Hey @cerupcat,

Indeed we don't have a guide specifically for that on mobile, that's a good feedback and I'll make sure to add it as a task.

Now here is what you should do in order to achieve this:

For sorting, we recommend the following guide. Basically, the best way to deal with sorting is to create Algolia replicas indices that will have your data sorted in a particular way. In that way, you ensure that the performance of your query is lightning fast.

On the iOS side, what you'll have to do is:
1- Make sure you're in MultiIndex mode by following this guide.
2- When the user switches the sort mode, you just target the new replica index by changing the value of the index property that is found in the HitsTableWidget.

If you're not using widgets specifically, and just using a Searcher or Index, then what you'll have to do is change the value of the index there to reflect the new targeted replica index.

Best,

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

No branches or pull requests

2 participants