Umbraco Examine - Using both fuzzy & wildcard search

1.3k views Asked by At

I'm trying to build a search engine and I want to use the benefits of both Fuzzy() and MultipleCharacterWildCard().
The problem is that I can't get them to be combined together... And I don't understand why.
My code:

var searchArr = ["word", "another", "blabla"];

for (int i = 0; i < searchArr.Length; i++) {
    searchCriteria
        .And()
        .GroupedOr(searchFields, searchArr[i].EscapeRegexSpecialCharacters().MultipleCharacterWildcard())
        .Or()
        .GroupedOr(searchFields, searchArr[i].EscapeRegexSpecialCharacters().Fuzzy());
}

It performs only the Wildcard search in that case. If I'll switch between them, it will perform only the fuzzy.
Any solutions to combine those two?
Thanks.

1

There are 1 answers

1
Jon Jones On BEST ANSWER

which version of umbraco? Maybe https://our.umbraco.com/packages/website-utilities/ezsearch might help.

var filter =  searchCriteria
        .And()
        .GroupedOr(searchFields, searchArr[i].EscapeRegexSpecialCharacters().MultipleCharacterWildcard());

var filter1 =  searchCriteria
        .And()
        .GroupedOr(searchFields, searchArr[i].EscapeRegexSpecialCharacters().Fuzzy());

var allProducts = filter.Concat(filter1).ToList();

That would combined them both if you are stuck :P