We can highlight important information in search results for site users by using keywords and Best Bets. When a user enters a pre-configured keyword term into the search box, Best Bets are displayed prominently at the top of the core search results page.
Use the below format for the CSVfile input
BestBet,UserContext,Keyword,Description,Url,StartDate,EndDate,Position
"IRS","","Income Tax;Tax;","Internal Revenue Service","http://irs.gov/","","",""
Sample PowerShell Script
Add-PSSnapin AdminSnapIn -erroraction SilentlyContinue
Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$sa = "Search Service App Name"
$ssa = Get-SPEnterpriseSearchServiceApplication $sa
$siteurl = "http://siteurl/"
$ruleManager = New-Object Microsoft.Office.Server.Search.Query.Rules.QueryRuleManager ( $ssa )
$isVisualBB = "false"
$bestBetCSVFile = import-csv "BestBet.csv" -erroraction SilentlyContinue
Write-Host "File Imported"
foreach ( $row in $bestBetCSVFile )
{
$bestBetName = $row . BestBet
$rulename = $bestBetName
$contextName = $row . UserContext
$keywordName = $row . Keyword
$description = $row . Description
$url = $row . Url
$startDate = $row . StartDate
$endDate = $row . EndDate
$position = $row . Position
Write-Host $bestBetName $rulename $contextName $keywordName $description $url $startDate $endDate $row . Position
if ( $keywordName ) {
createBestBetQueryRule -rulename $rulename -keyword $keywordName -ruleManager $ruleManager -bestBetName $bestBetName -contextName $contextName -description $description -url $url -startDate $startDate -endDate $endDate -position $position -isVisualBB $isVisualBB
Write-Host "Added BestBet ' $bestBetName ' to Keyword ' $keywordName '"
}
}