Smart search Or clause for filters

Gleb Itenberg asked on September 25, 2018 13:47

I'm using custom smart search with filters. Now I'm using this code to combine search conditions

            var fo="term1 term2";
            var filterText = SearchSyntaxHelper.GetFilterCondition(filterFieldName, fo);
            filterText = SearchSyntaxHelper.GetRequiredCondition(filterText);
            SearchSyntaxHelper.AddSearchCondition(queryText, filterText);

As a result query text looks like "+(keyword) +_filterFieldName:(term1 term2)". This request will return me all items that contains in index term1 AND term2. But how can I get a filter that will use OR clause? I mean I want to get items that contains in index term1 OR term2

Correct Answer

Peter Mogilnitski answered on September 25, 2018 19:02

try Zach's suggestion or +_filterFieldName:(term1 OR term2). Here is a topic on stackoverflow

0 votesVote for this answer Unmark Correct answer

Recent Answers


Zach Perry answered on September 25, 2018 17:42

You should be able to just add the same filter with an OR. +(_filterfieldName:term1 OR _filterfieldName:term2)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.