Simplest way to exclude variants by options title

Looking to replace our current search with Algolia.
What is the quickest way to exclude variants from showing up in the search page and autocomplete. We sell fabric and have half yards as variants but do not want to include them in the search results. I see them show up as “options.title” in the browse section of the dashboard under Indices. I read a few posts but still not sure where to make the change. I need to exclude all product variants that have “Half Yard” as the options title. Thx.
Last note: The word half yard shows up in the options title and the variant title so either would work.

Hi,
I will give you 2 options, each doing something slightly different.

  1. If you want to remove every record with a “half yard” in options.title, then you will need to use a negative filter, as outlined here:
    https://www.algolia.com/doc/guides/searching/filtering/#negative-filters.
    For example, this, you would put “NOT title:half yard” in your filters.

  2. If you want to remove all but one record with “half yard” in the options.title, you will need to use Distinct. Here is an example of how that works:
    https://www.algolia.com/doc/tutorials/full-text-search/distinct/#dataset

Please let me know if that answers your question.

Peter

1 Like

100% to what @peter.villani just said.

I think you’re looking for the option 1.
Something to note, the attribute must be exactly half yard, not contain it (e.g. something ... half yard).

Specifically for Shopify, you can look at those two posts which show how to add a filter to the autocomplete:

If you want to do this both for the autocomplete and the instant search page, I’d recommend you to create an API key with this negation filter directly baked in, as described in the next link, and to use it as your search API key in the Setting tab of the application.