Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cian-evans opened this issue Jan 23, 2025 · 1 comment
Labels

Comments

@cian-evans
Copy link

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.

@Shazwazza
Copy link
Owner

Interesting. We have a lot of test cases covering most things. Perhaps this is one that isn't covered but I'd have to check.

Tests are here: https://github.com/Shazwazza/Examine/blob/support/3.x/src/Examine.Test/Examine.Lucene/Search/FluentApiTests.cs
It is easy to fork this repo and write a test if you have time to help contribute on branch support/3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants