To do so, you'll first need to put the Country
attribute in your attributesForFaceting
list. You can do that using the REST API, your client of choice or from the Algolia Dashboard. Using the later one, go to the Indices
page, select your index and click on the Display
tab. Here, you could add your Country
field to the Attributes for faceting
list. After that, click on save and your index will be rebuild.
Now, your index is ready to filter the search queries according to the country you want. To perform the search query, you can use (using the Ruby client):
Contact.search("Batch", {
facets: ["Country"],
facetFilters: ["Country:Germany"]
})
For more informations about faceting, here is a quick intro from the FAQ and a more detailed guide in the documentation.