Tuesday, March 29, 2011

Why you still should prefer PowerShell over UI to create Search Scopes in FAST for SharePoint

When SharePoint 2010 came out the only way to create a search scope was to do it by PowerShell. Well, you could create the scope name itself via Central Admin, but the actual scope filter had to be done via PowerShell.


If you picked up on what changes in the Cumulative SharePoint 2010 updates you might have noticed that the August 2010 release changed this.
When you create a search scope by using FAST Search, you have to have a scope filter that matches the scope rules attached to the search scope. However, the scope filter is empty and must be set manually by using PowerShell when you create a new search scope.
But it’s not necessarily that easy. For every managed property you might have defined for FAST, you have to create a shadow copy/placeholder which you can use in your scope. There is a 9 step list at TechNet outlining the procedure. Also the GUI limits you to filter on web address or a specific property, much like the keyword syntax in the search page.

By using PowerShell you have the full force of fql at your disposal, and no need to create placeholder properties. For example the following query will boost documents from a particular site, and from a particular department to the top of the list.
xrank(path:starts-with("http://site/"),escdeptname:ends-with("1200"), boost=10000)
It’s nice that GUI support is added, but I will still stick to PowerShell for scopes for the time being :-)