0

We're searching our index on algolia through the api and rendering facets and their values each time the search is updated. Each facet returns a maximum of 5 values to show the user.

When a facet attribute is selected, the search result json returns that facet and its attributes re-ordered first by their count and second by alphabetical order. Usually the just-elected facet value is shown first and we're happy with that.

If we then select another facet with a count of say 10, then in the returned search results, if there are other facet values that have not been selected but that also have a count of 10 and are higher up in alphabetical order they'll popup ahead of the just-selected facet removing it from sight for the user. And that's unusual because the user expects to see what they just selected in the returned results.

How can we ensure that the returned search result facet values show up in the order: highest count, selected, and then alphabetical as opposed to highest count, alphabetical?

Thanks

David Haddad
  • 3,796
  • 8
  • 32
  • 40

1 Answers1

0

This question was cross-posted to Algolia's forum, you can see the full discussion here.

The short answer is:

"The main problem here is that you are using the raw API Client instead of the JS Helper which we strongly recommend: it handles a search state internally, it has advanced features built-in (like facets sorting) and it's really easy to use. You can go from a JS Client to a Helper implementation very easily (you won't struggle if you switch)."

Josh Dzielak
  • 1,803
  • 17
  • 19