Creating sorting Connector for multiple facets in react-native

Hi, I’m working on a react-native shopping app and been trying to get my head around connectors.

I want to create a dropdown that sorts a single product index’s hits by multiple facets (lowest price first, highest, on special first etc.

I’ve looked through all the connectors and there doesn’t seem to be any that handle this specific case. I’m currently using the connectInfiniteHits connector but it doesn’t have a transformItems prop.

I tried to use the connectHitsPerPage which does have the transformItems but couldn’t get it working. Not sure if allows the user to select the sorting method either. Do I need to write up a custom connector or is there an easier way?

Cheers

1 Like

Hi @caly!

To have multiple sorting strategy with Algolia, you need to use multiple indices. You can find more information about it here: https://www.algolia.com/doc/guides/relevance/sorting/#multiple-sorting-strategies

Once you have multiple indices, then you can use the connectSortBy connector. You will use the index name as the value to refine.

Let me know if it works :slight_smile:

1 Like