Make "face mask" rank above "face mask required sign"?

We’re getting a lot of false positive results from queries like “face mask” returning results like “Face Mask Required Sign.” One of our data sources has a ton of signs so this is often giving junky results. Is there something we can do about this in configuration that doesn’t involve having a lot more data and/or search traffic?

Hi @alicia, since ‘face mask’ is a substring of ‘face mask required sign’, then the query ‘face mask’ will be considered a match to that attribute for both strings. You could add an attribute to distinguish between signs and other items and then use optionalFilters to boost the other items above the signs.

For instance, if you want the signs to show up at the bottom of the results you cold add an attribute named ‘sign’ (or any name you prefer), and set it to true for signs and false for other items. Then use an optionalFilter in your search parameters like this:

{“optionalFilters”: “sign:false”}

This will boost any items that have sign set to false above items that have sign set to true.

If you don’t want the signs to show at all in the list, you could use a filter instead of an optionalFilter.

There may also be other ways to tweak your ranking strategy using custom ranking or changing the order of your searchable attributes that would also help you get the results you need.

Thank you, Cindy. We will try custom ranking for now, and then optionalFilters if we want a stronger boost.

1 Like