0

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.

1

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()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.