Question

I have created 3query rules in SharePoint 2013. I need to create query rule group using powershell and and define the ordering . anyone give me the better idea to create query rule group using powershell.

Was it helpful?

Solution

Since you already have the query rules created you have the hard part out of the way. You need to decide for each rule whether you Continue or Stop after each rule is processed. This is the GroupProcessingDirective. For this sample your Query Rule is $qrPR.

#Pick Your Owner Scope
$owner = Get-SPEnterpriseSearchOwner -Level Ssa
#Create the filter
$ssaFilter =  New-Object Microsoft.Office.Server.Search.Administration.SearchObjectFilter($owner)
#Get the Group Collection
$qrGroups = $qrm.GetQueryRuleGroups($ssaFilter)
#Create a Query Rule Group
$newGroup = $qrGroups.CreateQueryRuleGroup("My New Demo Group")
#Add Rule To Group choose Continue or Stop
$newGroup.QueryRules.Add($qrPR,[Microsoft.Office.Server.Search.Query.Rules.GroupProcessingDirective]::Continue)
#Update the group
$newGroup.Update()
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top