What is the best way to filter results depending on country: New index, replica or geo-filtering?

Hey everyone.

We are not sure what is the best way to go about this and what are the pros / cons of each option. I saw a couple of post about creating a subset of the records of an index as a replica but they didn’t quite give me the answer.

So, we have a streaming platform where we use Algolia to provide the search functionality for content such as movies and series.
Right now we only operate in one country but soon will expand to various countries.
Given that the rights of exhibition are country-dependent we need to be able to filter the titles (records) based on each country.

We have discussed the following options:

  • Have a separate index for each country: each time we have to add, edit or delete a record we have to do it for each country separately. Any pros? Would this allow to have our analytics separated by country?
  • Have a main index, and a replica for each country: we would add an attribute to the records that identifies the countries that it should be visible, then create a replica for each country filtering on that attribute. Is it even possible? We did not find a way through the dashboard to ‘pre-filter’ a replica based on an attribute.
  • Have a main index, filter on front end: use the same attribute as stated above, but do the pre-filtering on the front end for each country.
  • Other? Such as the geo-filtering feature?

It is worth mentioning that is important to us to be able to view or filter in the analytics how each country performs and what is their search behavior.

Thanks!!

To me he best approach here is setting allowed countries as a facet on your records, then filtering on the facet on the front end.

If you are concerned about users bypassing the front end filter, you can always embed the filter for the authenticated user into a Secured API keys. These can’t be manipulated be the end user:

1 Like

Hey Chuck, thanks for that suggestion. It seems like a really good option vs the ones we were evaluating. In this case, to be able to identify the origin country in the analytics dashboard the recommendation would be to send it as an analytics tag with the user query?

Thanks again!

Yup! If you’re filtering on country of origin, it’ll show up in your facet analytics ( Top filter attributes and filter values)

1 Like

Great! That is the way to go :wink: