Don't Match On Attributes I Haven't Searched

I’m trying to work out if there’s a way to configure Algolia to ignore matches on attributes that are not included in my search query.

For example, assume these are my records:

{ id: 1, colours: ["blue"] },
{ id: 2, colours: ["blue", "yellow"] },
{ id: 3, colours: ["blue", "yellow", "green"] },
{ id: 4, colours: ["blue", "green"] },
{ id: 5, colours: ["yellow", "green"] }

The following search queries would return record(s) with the following id(s):

“blue” returns record with id 1
“blue, yellow” returns record with id(s) 1, 2
“blue, green” returns record with id(s) 1, 4
“yellow, green” returns record with id 5
“blue, yellow, green” returns record with id(s) 1, 2, 3, 4, 5

Is this at all possible?

Any help is appreciated. Thanks in advance.

Hi Raphael,

Would you be able to provide us with a bit more information about what it is you’re looking to achieve? With what you’re asking right now I’m having a tough time visualizing it, any more details would be very useful. With a little more information I’m sure we can find a good solution.