Smart Search filter in combination with OR clause

This article gives you instructions on how to use formating expression {0} to insert value to specified place inside search condition.
See the following examples below:

Field1{0} OR Field2{0};Value1:DisplayName1 will insert "Field1:(Value1) OR Field2:(Value1)" into the search query.

When search filter is in mode "MUST" the inserted condition looks like this: "+( Field1:(Value1) OR Field2:(Value1) )".

When search filter is textbox:
Field1{0} OR Field2{0} will insert condition "+( Field1:([TextBoxValue]) OR Field2:([TextBoxValue]) )".

 Now lets put this theory into practise.  I suppose, you have already smart search working on your site, so you need to add a smart search filter web part on the same page where your search logic  is located.

You need to set following properties of smart search filter web part:

-    Search Dialog webpart ID, this property must match to your search dialog web part ID
-    Filter mode set to "Text box“
-    Values set to “ _content{0} OR DocumentTags{0}“

Now go to for example on your Home page to Properties -> Metadata and set Page tags to „school“. Then you should visit the live site and fill filter text box to „school“, you should be able to display the results which belongs to at least  one of the values  which you have specified on Values property.

Please note that this scenario is applicable only with hotfix 75 and higher applied. In previous hotfixes you could add only values in structure below:


So when you search for something throw the FILTER it must appear in both documents.
Share this article on   LinkedIn