Exclude results with matchLevel === "none"

Is there an easy way to exclude results from a search if their matchLevel is none? I am able to write an if/else statement easily enough, but I suspect there’s probably a higher level setting I could use.

Do you mean you only want results which have a match in a certain attribute that you want to show? In that case it might be best to only have that one in searchableAttributes.

Does that help you?

Ah ha — so it’s only showing that result because it has a match level of full on the ‘name’ attribute (in this case). Yes, excluding that attribute from searchableAttributes will solve it here. Thank you.

Is there any documentation I can read on what qualifies as a full vs. partial vs. none match?

1 Like

Hey @alexhollender, if I remember it correctly, it means “the match was not in this attribute, but another”, “the match is in part of a word”, “the match is the complete word”.

Oh, and some more info (copied from an internal conversation):

It’s based on how many meaningful words from the query string the records matches.

  • none = 0
  • partial = some, but not all
  • full = all

By “meaningful”, I mean: if stop words are removed, they are not taken into account. So if you match everything but stop words (and removeStopWords is enabled), then it’s a full match.

Note that it has nothing to do with prefixes, plurals, synonyms or typos. No matter how “accurately” a word matched, if it did, it counts as one.

The same information could be deduced from _rankingInfo.words and parsedQuery.

1 Like