And yet yesterday I discovered a valuable piece of nugget which I’m sure I will use a lot in the future.
Up until yesterday this was my complete understanding of promotions and demotions in FAST for SharePoint.
You can promote and demote items based on it’s url. Via SharePoint admin UI the boost is absolute by adding 1,000,000 rank points, effectively pushing the item to top of the result list.
If using the SharePoint UI you have to add the promotions to a keyword, but when using PowerShell you can make a “global” promotion which affects all search queries.
You can promote and demote sites based on the start of a url. For example promoting “http://site/” via SharePoint admin UI will give all items which has a url starting with “http://site/” 1,000 extra rank points. A soft boost.
Using PowerShell to create promotions and demotions lets you specify the boost value yourself.
Each of the promotions can be associated with a user context in order to target the promotion to specific users, and you can set a start and end date for the promotion.
There is MORE!This is all good, but there is more. Doing some PowerShell scripts around promotions I stumbled upon the very little documented function AddPromotedExpression. If you google this function you will get two hits, both on MSDN with the very sparse documentation text
“Creates a promoted expression and adds it to the collection.”
with the function signature:
PromotedExpression AddPromotedExpression( string fqlExpression )
What this means is we can write an arbitrary FQL expression for promoting or demoting items. Let’s say we want to demote all items which are larger than 3MB and located on a file server. The following fql will match the criteria:
Executing the following lines in a FS4SP PowerShell will add the demotion:
$searchSettingGroup = Get-FASTSearchSearchSettingGroup $globalPromotions = $searchSettingGroup.PromotionsWithoutKeyword $globalPromotion = $globalPromotions.AddPromotion("FQL size and file") $globalPromotion.BoostValue = "-4000" $fql = 'and(size:range(int("3145728"),max,from="gt",to="le"),url:starts-with("file://"))' $globalPromotion.PromotedItems.AddPromotedExpression($fql)
Hope this will come in handy!