Monday, October 27, 2014

Caution when creating global query rules

If you create query rules which modify the query on your tenant or SSA level, then you are effectively killing off any such rules on the site collection level.

The below screen shot is taken running a query in the query rule tester. You see the first rule for blog’s is triggered. This rule has been set to stop, as it modifies the query and I want no more processing. You can see the stop flag actually works works, as the next rule is grayed out.

But then a rule from the SSA is showing in blue again, not honoring the Stop flag from the site collection. Ideally it should have been grayed out as well. The reason for this is that if you have more than one rule which modifies your query, then neither is executed (even though the test interface shows so).

image

In my case the SSA rule is adding an exclusion rule for all search results on Local SharePoint Results. The way to solve this is to create a custom result source on the SSA (or any other level where you need it), add the exclude filter here, and set this source as the default source instead.

Or if the results excluded shouldn’t be used anywhere, mark the site not to be indexed instead.