Reputation: 97
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.
Upvotes: 0
Views: 1569
Reputation: 1084
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
Upvotes: 2