If we are talking about folders from file shares this is not too hard. If we refer to my post about Taking promotions/demotions one step further we can accomplish this by adding negative promotion using XRANK.
Firstly we need to identify folders which can be accomplished by using the IsDocument property, which for folders will be false.
Secondly we need to limit to file shares which can be accomplished by looking at the path property of the result, in this case it will start with file://.
XRANK takes at least three parameters, where the first one is the matching query, the second is the boost query and the last is the boost value. Using promotions the first part is made up by the users query, and the second is the FQL used to match folders on a file share as seen below.
To implement the demotion we’ll use PowerShell:
$searchSettingGroup = Get-FASTSearchSearchSettingGroup $globalPromotions = $searchSettingGroup.PromotionsWithoutKeyword $globalPromotion = $globalPromotions.AddPromotion("Demote folders") $globalPromotion.BoostValue = "-1000000" $fql = 'and(isdocument:false,path:starts-with("file://"))' $globalPromotion.PromotedItems.AddPromotedExpression($fql)
For all queries the above fql will be added, demoting folders to the end of the result list. Other items may still appear below the folders if for example the freshness part (static boost) of the query pushes it above the folders. We can remedy this by giving a boost to all items which have IsDocument set to true.
$globalPromotion = $globalPromotions.AddPromotion("Promote non-folders") $globalPromotion.BoostValue = "5000" $fql = 'isdocument:true' $globalPromotion.PromotedItems.AddPromotedExpression($fql)
Another approach may be to match all items with size = 0, and demote those instead.