Shopify <> Query Rule: How do I remove product results with certain tags?

I am trying to only allow results that match the “_tag”=“subcategory:Neon Lights” for the query “neon light” with a query rule. I have this so far but it’s not clear why I’m still getting an error when following this format: https://www.algolia.com/doc/guides/query-rules/query-rules-usage/

{
“condition”: {
“neon light”
:
“consequence”: {
“params”: {
“automaticFacetFilters”: ["_tags":“data–sub_category:Neon Light”]
}
}
}
}

A small disclaimer here.

Query rules are currently unsupported with the Shopify extension.
This means that you can add some to your index, but if you ever click Reindex, they’ll be overriden.
We’ll work on adding this in a near future, but I can’t give you an ETA just yet.

Such a bummer. Is there any way in the short term to hide certain results outside of query rules? Thx.

If your goal is simply to hide some products, you can easily do this using the algolia-ignore tag or [hidden] in the product / variant name.

1 Like

Query rules are now supported by the integration, see https://community.algolia.com/shopify/changelog.html#1-34-0-01-12-2017 .
So you can now set them up in your Algolia dashboard, they won’t be overridden when reindexing.

If we’d like to filter a specific search to only products with a given tag, like Lauren described, how would we do this? I’ve tried adding the following query rule using the “Add Query Parameter” consequence for the search containing “Neon Light”: {“tags”:“data–sub_category:Neon Lights”}

But when I try the search it shows 0 results. I’ve confirmed there are numerous products with the “data–sub_category:Neon Lights” tag.

After a closer look at the documentation I think I figured out how to apply the filtering by tag following this pattern: {“filters”:“tags: ‘data–sub_category:Neon Lights’”}. It went from 92 results down to 11.

This sounds about right!

Since it sounds like you’re using our Named tags feature, you could probably have used this too:

{"filters": "named_tags.data–sub_category:'Neon Lights'" }

Hi Jerska,
nice to see you still active here.

I have a shop that I want to display all variant in the algolia search, appart for one specific product such is lilou → https://www.parispousse.fr/products/lilou-plantes-aromatiques-balconniere-fiberstone?variant=7264165429284

The thing with the [hidden] tag is that it is displayed on the product page names such as

So I was wondering if there is another easy way to hide a specific variant of only specific products, but the others are like before?

Thanks

You’re definitely correct, I hadn’t thought of that.
I see two fixes, none of them perfect though.


The first one would be to replace any call in your theme to {{ variant.title }} by {{ variant.title | remove_first: ' [hidden]' }}.
This would be fairly easy, but there might be a lot of places referencing it and missing it might be tricky.
Also, we’re modifying your theme for something really Algolia specific.


Another alternative I see would be to add a specific attribute to those variants.
It can be a named tag ( https://community.algolia.com/shopify/named-tags.html#restrict-to-some-variants ) or a metafield.
With this, you could then use the API key filtering solution in Shopify: Add a filter to the autocomplete and / or the search page .
Imagining you’ve used this tag:

[type:Romarin]algolia_hidden:number:1

You’d need to set this expression as filters:

named_tags.algolia_hidden != 1

And I believe you should be good to go!