Skip to content

Query not taking into account fuzziness after upgrading from Examine 1.2.2.0 to 3.3.0.0 #399

@cian-evans

Description

@cian-evans

We have an Umbraco v8 site which has been upgraded to Umbraco v13 recently, and we've noticed that the search results are quite different.

After inspecting the query that is created in V8 and V13, it looks like the fuzziness is only applied to the first search term, however this is set to 1 rather than 0.9:

v13
Query = {+(subTitle_cy:designated~1 subTitle_cy:sites~0 subTitle_en:designated~1 subTitle_en:sites~0 title_cy:designated~1 title_cy:sites~0 title_en:designated~1 title_en:sites~0)}

v8
Query = {+(subTitle_cy:designated~0.9 subTitle_en:designated~0.9 title_cy:designated~0.9 title_en:designated~0.9) (subTitle_cy:sites~0.9 subTitle_en:sites~0.9 title_cy:sites~0.9 title_en:sites~0.9)}

Here is the relevant code for when the IBooleanOperation is built:

var searchFuzzyness = 0.9f;
if (!searchTerm.Contains(" ")) return criteria.GroupedOr(textFields, searchTerm.Fuzzy(searchFuzzyness));

string[] terms = searchTerm.Split(' ');
var result = criteria.GroupedOr(textFields, terms[0].Fuzzy(searchFuzzyness));

for (int i = 1; i < terms.Length; i++)
{
    ;
    result.Or().GroupedOr(textFields, terms[i].Fuzzy(searchFuzzyness));
}
criteria.GroupedOr(textFields, terms[0].Fuzzy(searchFuzzyness));

return result;

If we inspect the IExamineValues after adding the fuzziness, we can see that the value is set correctly:

{Examine.Search.ExamineValue} Examineness: Fuzzy Level: 0.9 Value: "sites"

However once the "GroupedOr" is executed it them seems to disregard this and results in the query result above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions