Prevent search for looking into tags but filter by tags

Hello,
I managed to filter both autocomplete & instantsearch by tags.
Now, the problem appears if a users searches the tag name, I would like to retrieve results where only the title or the description matches the string. So basically, I want to exclude tags from being searched, while keeping the filtering by tags.

Is it possible?

Examples:
Product 1: Pet House (tag: pet)
Product 2: Dog House (tag: pet)
Current search result for “pet”: (filter by tags: pet) - return both products
Expected search result for “pet”: (filter by tags: pet) - return only Product 1 (since the searched string is in the title/description)

Hi,

If you only set only title and description in your searchableAttributes and tag in your attributesForFaceting, it should works as you expect.

Can you let me know if it worked?

@julienbourdeau, thank you!

Forgot to say I’m doing this for Shopify Plugin.
Any suggestions in which file I should add those? Ideally it should work on both autocomplete & instantsearch.

Thanks!

Maybe @Jerska can jump in for this. I haven’t got the chance to try our shopify extension yet.

Julien was indeed right! Just head to our app > Settings tab.

Here, you’ll see a Synchronize settings block. Click the link on the left to get to your index settings.
Here, in the searchable attributes list, you should be able to simply remove tags and have your search not look for textual matches in tags.

Then, to propagate this to your sort orders, go back to our Shopify application, and click Synchronize.

1 Like