SortBy causing hits not to be rendered

For some reason when I render my sortby it causes my hits not to be rendered.

It looks like this

  <SortBy defaultRefinment='demo_ecommerce' items={sortByItems} />

const sortByItems = [
value: ‘demo_ecommerce’,
label: ‘Most Relevant’,
value: ‘demo_ecommerce_popularity_asc’,
label: ‘Least Relevant’,
value: ‘demo_ecommerce_price_asc’,
label: ‘Lowest Price’,
value: ‘demo_ecommerce_price_desc’,
label: ‘Highest Price’,

When comment out the sortby my hits render just fine…any idea why this is happening? Thanks!

There’s a typo in defaultRefinement, you’re missing a e.

It might just be a typing issue when you created this ticket though.
If this is not your issue:

  • Are you seeing any errors in your browser console?
  • Are you seeing the query to Algolia in your Network tab? If yes, is it replying with a 200 status and does its response include hits?
  • Are you in a no results scenario (successful query but 0 results), or is there another issue? You can check this by implementing a “no results message” as described here: Conditional Display | Building Search UI | Guide | Algolia Documentation .

Hey thanks it was the typo :slight_smile: The E works. However when I try to sort the items I’m getting a 404 in the network tab now.

The response reads

“{“message”:“Index demo_ecommerce_price_desc does not exist”,“status”:404}”

This is just using the demo_ecommerce that comes with the free account.

This is expected: each sort order requires an index behind as sort orders are handled at indexing time.
If you haven’t configured your index’s replicas, you’ll get 404s.

You can read more about it here: Sorting Results | Managing Results | Guide | Algolia Documentation .
Summary: each sort order requires a dedicated index. To have the same data but different settings, we use replicas on the primary index. Each replica can be configured with its own settings, in this case a different sort order.

Great thank you!

So if I understand this correctly then each replica it tailored towards one sorting option since we set the sorting preferences inside the config



would be three different replicas with their sorts configured accordingly?

Hi, yes, that is correct! Three separate replicas for 3 different sort orders.

Cool thank you so much for the clarification!

We are thinking of using Algolia for a large client and this sort of support gives us confidence in moving forward with Algolia! :slight_smile: