InstantSearch JS search and display results based on word from attribute

I have simple search with results that displays results based on Refinements from one category per different page.
But come into an issue where have different results in database.
Basically record from category:
“Card” contains different data. I want to display and search within it based on a word that is available inside attribute “keywords” and / or “title”. As both have key word I want to filter and search based on.

One example is that inside category “Card” have different records.
“Title” is different but for some occasions it contain specific word like Easter, Valentine and others. Also “keywords” contain this word.

Is this possible to search and display based on that criteria?

Hey! Could you please provide a link to your site where we can experiment to get a better understanding of your case?

Sorry for late reply.
I solved that problem. Best way I come out was to mitigate search query based on extra data attribute I added to HTML code.

Issue I’ve been facing was basically limited by data inside existing Algolia DB on our side as category have one string with all categories separated only by comma and not as separate values.

But right now this works like a charm :slight_smile:

But I would like to use this opportunity and ask you different question.

What would be a best way to work out two different searchParameters - category and choose which one should run based on html tag.

I’ve got this:

searchParameters: {

    hitsPerPage: 38,

    disjunctiveFacetsRefinements: {

      category: productCat



productCat is variable. But I need to display different variables depends on a page. Where I can easily manipulate based on HTML Class or ID.

I have a page where I need category: to have multiple categories and rest of the pages needs only single category. This is manipulated by data attribute in HTML: data-category

Is there anything build in to InstantSearch JS that will help quickly manipulate searchParameters and category based on my requirements?

Ok. I tried to overthink this so I used if, else to declare what I need and matched everything I need. Problem solved :slight_smile: