How does matching work for Inferred Filters, Filtersearch or Full Text

When debugging answers search quality it’s often helpful to understand how some of the matching is working under the hood. These rules change over time as the system gets smarter but here is some hints on how it’s working today.

Before diving into how it works there are two important concepts.

Fuzziness a.k.a. Typo Tolerance
Fuzziness or Typo Tolerance makes it so that phrases don’t need to exactly match. For example, if you compare “apple” to “aple” these aren’t exactly the same but are pretty close. Answers uses Levenshtein Edit Distance to help deal with this scenario. In this case the edit distance is 1.

Prefix Matching
In certain cases, you want to match the prefix of works. For example in type ahead if the term is “ap” you might want to show “apple” so help the user complete their word. This is called prefix matching and can be combined with typo tolerance to help the user.

We use both of these approaches to help match. Here is a rough set of rules for the different searchable field types.

Inferred Filters
For Inferred Filters, we allow prefix matching and typo tolerance. The typo tolerance allows 0 edits for phrases of length 0-2, 1 edit for phrases of length 3-5 and 2 edits for phrases of 5+. This is combined with prefix matching.

Filter Search
For Filter Search, we allow prefix matching and typo tolerance. The typo tolerance allows 0 edits for phrases of length 0-2, 1 edit for phrases of length 3-5 and 2 edits for phrases of 5+. This is combined with prefix matching.

Full Text
For Full Text, we do not allow prefix matching but do allow typo tolerance. Full Text is a bit more restrictive than inferred filters and only allows an edit distance of 1 regardless of the length of the string.

1 Like