I’m currently using the following code to omit certain items from search results.
{% for item in search.results %}
{%- if item.type contains 'HIDDEN_PRODUCT' -%}{%- continue -%}{%- endif -%}
{%- if item.tags contains 'discontinued' %}{%- continue -%}{%- endif -%}
However, I am switching to a new theme and instead of {% for item in search.results %}, the new theme uses {%- for result in search.results -%} for the loop.
As a result, the above code I’ve been using to omit certain results no longer seems to work. I’ve tried tons of different variations of code to try to get this work, and I can’t seem to figure it out.
Hi,
If new theme is using result variable to iterate over search results then you can try below code:
{% for result in search.results %}
{%- if result.type contains 'HIDDEN_PRODUCT' -%}{%- continue -%}{%- endif -%}
{%- if result.tags contains 'discontinued' %}{%- continue -%}{%- endif -%}
Basically, you can use result in place of item.
I hope, it helps you
Thanks!
Gosh, I feel like I tried that, but I guess I didn’t. That was so glaringly obvious. Thanks!
Nevermind, actually. That didn’t work. 
Hang on, I might be onto something. I’ll post back after I mess around a bit more. It seems I have two search files in my theme and they function on different parts of the site.
Okay, looks like this did work. For anyone reading this, just make sure to check is your have multiple search files. I had a predictive-search.liquid file in addition to my main search file that I also had to update.