One thing I've noticed about Query Rules, Search Admins are really good at creating Query Rules… not so good at deleting them. Query Rules become difficult to manage when the number of rules in the environment grows to several dozen, hundreds or even thousands.
As content and relevancy change with time, Query Rules may become invalid or unnecessary. For example, a Promoted Result Query Rule (Best Bet) may now point to a resource that no longer exists or the document a Promoted Result points to which was previously buried deep in the search results is now the #1 result.
To this end I created a script that will help the Search Admin identify and delete "invalid" Query Rules. The intention of the script is to identify three basic use cases, log and, if desired, delete the logged Query Rules. The use cases are:
- The URL in a Promoted Result action of the Query Rule is no longer valid.
- The Promoted Result appears in the top search results.
- The Query Rule no longer has Actions.
The script may be downloaded from the TechNet Script Gallery. Click on over to https://gallery.technet.microsoft.com/PowerShell-script-tests-b20b780d to learn more.