Sorting with JS API client and Search Helper

Hey everyone,

I’ve got a few questions regarding sorting with Algolia. I am currently using the JS API client and the JS Search Helper library.

  1. I can get sorting to work by using helper.setIndex(‘name_of_index’).search(). However, any selected facets or refinements are cleared. Anyway to prevent this from happening?

  2. Are you able to sort by non-numerical data (ie. Sort by Name)? Most of the examples I’ve seen have been numeric sorting (by price/date) with replica indexes.

Hi @jaguilar,

  1. When switching the index with setIndex, the only automatic work we do is re-setting the page number to 0 (because that’s what you want most of time). It should not reset any facet filter being set. Can you publish a live example demonstrating the issue? Maybe on https://jsfiddle.net/

  2. You can sort alphabetically with Algolia, have a look: https://www.algolia.com/doc/guides/relevance/sorting/#complex-sorting-strategy-using-multiple-metrics