SharePoint 2013 – Manage Search Query Rule using Powershell

10
Views

Following the Search Application Provisioning and Search Result Source configuration post, this post outlines how to configure Search Query rules in the SharePoint 2013.

Summary:

  • Initialize and get an instance of the Search Service Application
  • Update the existing Search Result Source (Site collection level)
  • Create a new Search Query rule
  • Set the rule condition and bind it to the Search Result source
  • Set the Query condition action to sort by “FileName” in descending order.
  • Search Results

Assumption:

Initialize and get an instance of the Search Service Application

Update the existing Search Result Source

Note: The below script sets the existing Result Source to a default one and without any filters.

Create a new Search Query rule

Note: The below script creates a new query rule for the search term “test”

Set the Query condition to sort by “FileName” in descending order.

Search Results

Step1 : Go to the site (http://win-2j3idcdeuh6/) and search for “test”. The search result brings all the test pages (testpage2.aspx and testpage1.aspx) in a descending order.

Step 2: Deactivate the rule and search for “test” in the search screen

Step 3: Search for “test” again and displays the results in the default order.

The full script can be downloaded from here

(10)

No ratings yet.

Please rate this

SharePoint 2013 – Manage Search Query Rule using Powershell

Profile photo of Balamurugan Kailasam
About The Author
-

8 Comments

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">