<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search Guys</title><link>http://blogs.technet.com/b/searchguys/</link><description>Everything search, including product commentary and guidance, search strategies and general technical guidance</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>How to throttle a BCS crawl</title><link>http://blogs.technet.com/b/searchguys/archive/2013/04/19/how-to-throttle-a-bcs-crawl.aspx</link><pubDate>Fri, 19 Apr 2013 19:19:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3567977</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3567977</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2013/04/19/how-to-throttle-a-bcs-crawl.aspx#comments</comments><description>&lt;p&gt;Throttling a BCS crawl is done the same way as other SharePoint crawls, using &lt;a href="http://technet.microsoft.com/en-us/library/cc261720(v=office.12).aspx"&gt;crawler impact rules&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The main trick is figure out what site name to use.&amp;nbsp; The most precise way is to use a combination of the LobSystem name and the LobSystemInstance name.&amp;nbsp; In my case it was "recipeslob_recipesinst" :&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/7612.image_5F00_05E9F2FC.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/8228.image_5F00_thumb_5F00_23CB07AE.png" alt="image" width="699" height="399" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;An alternative is to use the LobSystem name with a wildcard (e.g. recipeslob_*).&lt;/p&gt;
&lt;p&gt;Now we can set our rule (click on &amp;ldquo;Crawler Impact Rules&amp;rdquo; in the Crawling group of the Search Service Application management in Central Admin:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/1768.image_5F00_70FB0139.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3441.image_5F00_thumb_5F00_1E7C20FD.png" alt="image" width="221" height="305" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;From there click &amp;ldquo;Add Rule&amp;rdquo; and fill it in:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/8750.image_5F00_79EA9378.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/0257.image_5F00_thumb_5F00_1BD5F5FD.png" alt="image" width="635" height="445" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To see that it is working, watch the &lt;strong&gt;Search Gatherer - SharePointServerSearch / Threads Accessing Network&lt;/strong&gt; prefmon counter.&amp;nbsp; In this screen shot you can see during the crawl only one thread accessing the network.&amp;nbsp; Also observer that the requests in my console output are going in a nice neat linear order:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/0172.image_5F00_0516AE74.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/2766.image_5F00_thumb_5F00_44746204.png" alt="image" width="654" height="325" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now I&amp;rsquo;ll change the rule to 4 and run again:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3362.image_5F00_18C39808.png"&gt;&lt;img style="display: inline; background-image: none;" title="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3276.image_5F00_thumb_5F00_2FF1A337.png" alt="image" width="638" height="298" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Notice that now there are four threads accessing the network and that the requests are coming in bunches.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3567977" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/BCS/">BCS</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+2010/">SharePoint 2010</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+2013/">SharePoint 2013</category></item><item><title>SP2013: Getting at the Search Results web part Search Criteria via PowerShell</title><link>http://blogs.technet.com/b/searchguys/archive/2013/04/04/sp2013-getting-at-the-search-results-web-part-search-criteria-via-powershell.aspx</link><pubDate>Thu, 04 Apr 2013 18:29:33 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3563562</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3563562</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2013/04/04/sp2013-getting-at-the-search-results-web-part-search-criteria-via-powershell.aspx#comments</comments><description>&lt;p&gt;Back in the SharePoint 2010 days to change the source of the Core Results Web Part you would simply set the Scope property on the web part object and be done with it.&amp;#160; In SharePoint 2013 we have query builders and result sources and things aren’t quite as straight forward.&lt;/p&gt;  &lt;p&gt;First things first, lets get our web part object:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;$siteUrl = &lt;span class="str"&gt;&amp;quot;http://server/search&amp;quot;&lt;/span&gt;  # or whatever your site url &lt;span class="kwrd"&gt;is&lt;/span&gt;
$resultsPage = &lt;span class="str"&gt;&amp;quot;Pages/results.aspx&amp;quot;&lt;/span&gt; # or whatever your search results page &lt;span class="kwrd"&gt;is&lt;/span&gt;
$resultsUrl = &lt;span class="str"&gt;&amp;quot;$siteUrl/$resultsPage&amp;quot;&lt;/span&gt;

$spweb = Get-SPWeb $siteUrl

# Check &lt;span class="kwrd"&gt;out&lt;/span&gt; the page so we can make changes
$page = $spweb.GetFile($resultsPage)
$page.CheckOut()

# Get the web part manager &lt;span class="kwrd"&gt;for&lt;/span&gt; the page
$webPartManager = $spweb.GetLimitedWebPartManager($resultsUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)

# And pull the web part we want to work on
$webpart = $webpartmanager.WebParts | ? { $_.Title -eq &lt;span class="str"&gt;'Search Results'&lt;/span&gt; }

&lt;/pre&gt;

&lt;p&gt;So far this is working the same as it did in 2010.&amp;#160; The difference is that the 2013 search criteria is now stored inside the DataProviderJSON property:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;PS C:\&amp;gt; ConvertFrom-Json $webpart.DataProviderJSON

QueryGroupName                        : Default
QueryPropertiesTemplateUrl            :
IgnoreQueryPropertiesTemplateUrl      : False
SourceID                              :
SourceName                            :
SourceLevel                           :
CollapseSpecification                 :
QueryTemplate                         : {searchboxquery}
FallbackSort                          :
FallbackSortJson                      : &lt;span class="kwrd"&gt;null&lt;/span&gt;
RankRules                             :
RankRulesJson                         : &lt;span class="kwrd"&gt;null&lt;/span&gt;
AsynchronousResultRetrieval           : False
SendContentBeforeQuery                : True
BatchClientQuery                      : True
FallbackLanguage                      : -1
FallbackRankingModelID                :
EnableStemming                        : True
EnablePhonetic                        : False
EnableNicknames                       : False
EnableInterleaving                    : True
EnableQueryRules                      : True
EnableOrderingHitHighlightedProperty  : False
HitHighlightedMultivaluePropertyLimit : -1
IgnoreContextualScope                 : False
ScopeResultsToCurrentSite             : False
TrimDuplicates                        : True
Properties                            :
PropertiesJson                        : {}
ClientType                            : AllResultsQuery
UpdateAjaxNavigate                    : True
SummaryLength                         : 180
DesiredSnippetLength                  : 90
PersonalizedQuery                     : False
FallbackRefinementFilters             :
IgnoreStaleServerQuery                : True
RenderTemplateId                      :
AlternateErrorMessage                 :
Title                                 :&lt;/pre&gt;

&lt;p&gt;Since this is the default search results page you’ll see that there is no Source set and the QueryTemplate is the default “{searchboxquery}”. &lt;/p&gt;

&lt;p&gt;To change the source you’ll need the Name, Level and Id and I haven’t yet figured out how to find the source id.&amp;#160; So for now, we’ll just modify the QueryTemplate:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;# Add a property restriction to the query template
$dataProvider = ConvertFrom-Json $webpart.DataProviderJSON
$dataProvider.QueryTemplate = &lt;span class="str"&gt;&amp;quot;{searchboxquery} source:filesystem&amp;quot;&lt;/span&gt;
$webpart.DataProviderJSON = ConvertTo-Json $dataProvider -Compress

# Save the changes and check it back &lt;span class="kwrd"&gt;in&lt;/span&gt;
$webpartmanager.SaveChanges($webpart)
$page.CheckIn(&lt;span class="str"&gt;&amp;quot;Changed the Query Template&amp;quot;&lt;/span&gt;)
$page.Publish(&lt;span class="str"&gt;&amp;quot;Changed the Query Template&amp;quot;&lt;/span&gt;)
&lt;/pre&gt;

&lt;p&gt;Now when we open up the web part editor and click on the “Change query” button we see our change:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/1376.image_5F00_636B3485.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/1411.image_5F00_thumb_5F00_10802154.png" width="494" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Happy days are here again…&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3563562" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/PowerShell/">PowerShell</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/Search+Center/">Search Center</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+2013/">SharePoint 2013</category></item><item><title>Mucking with search summaries in SP2013</title><link>http://blogs.technet.com/b/searchguys/archive/2013/04/03/mucking-with-search-summaries-in-sp2013.aspx</link><pubDate>Wed, 03 Apr 2013 15:46:54 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3563081</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3563081</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2013/04/03/mucking-with-search-summaries-in-sp2013.aspx#comments</comments><description>&lt;p&gt;For a project I’m working on I needed to add some redaction to the hit highlighting summaries of the search results.&amp;#160;&amp;#160; If I see anything that looks like a social security number, then replace the first five digits with asterisks.&lt;/p&gt;  &lt;p&gt;At first this looked somewhat daunting because looking in the item templates, all the action on rendering the summary is inside of the ctx.RenderBody method:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;_#= $htmlEncode(itemId) =#_&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Item&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;data-displaytemplate&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;DefaultItem&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ms-srch-item&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;onmouseover&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;_#= ctx.currentItem_ShowHoverPanelCallback =#_&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;onmouseout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;_#= ctx.currentItem_HideHoverPanelCallback =#_&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    _#=ctx.RenderBody(ctx)=#_
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;_#= $htmlEncode(hoverId) =#_&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ms-srch-hover-outerContainer&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;After a little poking and prodding, it turns out all you need to do is modify the HitHighlightedSummary value before the RenderBody is called.&amp;#160; Add your code after the $setResultItem as follows:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;$setResultItem(itemId, ctx.CurrentItem);

&lt;span class="rem"&gt;// Redaction of Social Security Numbers&lt;/span&gt;
&lt;span class="kwrd"&gt;var&lt;/span&gt; snippet = ctx.CurrentItem[&lt;span class="str"&gt;'HitHighlightedSummary'&lt;/span&gt;];
&lt;span class="kwrd"&gt;if&lt;/span&gt; (snippet) {
    &lt;span class="kwrd"&gt;var&lt;/span&gt; re = /(?:&amp;lt;c0&amp;gt;)?[0-9]{3}(?:&amp;lt;\/c0&amp;gt;)?-(?:&amp;lt;c0&amp;gt;)?[0-9]{2}(?:&amp;lt;\/c0&amp;gt;)?-((?:&amp;lt;c0&amp;gt;)?[0-9]{4}(?:&amp;lt;\/c0&amp;gt;)?)/g;
    snippet = snippet.replace(re, &lt;span class="str"&gt;'***-**-$1'&lt;/span&gt;);
    ctx.CurrentItem[&lt;span class="str"&gt;'HitHighlightedSummary'&lt;/span&gt;] = snippet;
}&lt;/pre&gt;

&lt;p&gt;The regular expression is somewhat complicated because it needs to account for highlighting tags (&lt;c0&gt;&lt;/c0&gt;). Note that you can add to the HitHighlightedSummary yourself and can use the &lt;c0&gt; tags if desired.&lt;/c0&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3563081" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/Search+Center/">Search Center</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+2013/">SharePoint 2013</category></item><item><title>SharePoint 2013 and Search Service PerformanceLevel</title><link>http://blogs.technet.com/b/searchguys/archive/2013/02/24/sharepoint-2013-and-search-service-performancelevel.aspx</link><pubDate>Sun, 24 Feb 2013 17:10:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3554679</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3554679</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2013/02/24/sharepoint-2013-and-search-service-performancelevel.aspx#comments</comments><description>&lt;p&gt;Just a quick note&amp;hellip;&amp;nbsp; &lt;a href="http://technet.microsoft.com/en-us/library/ff608126%28v=office.15%29.aspx"&gt;Set-SPEnterpriseSearchService&lt;/a&gt; still has the PerformanceLevel option in SP2013, but apart from the crawler component it doesn&amp;rsquo;t do anything.&amp;nbsp; And in practice changing from Maximum (the default) to Partly Reduced won&amp;rsquo;t achieve much throttling anyway.&amp;nbsp; Best just leave it at Maximum.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3554679" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+2013/">SharePoint 2013</category></item><item><title>Content Processing Performance Scaling</title><link>http://blogs.technet.com/b/searchguys/archive/2013/02/19/content-processing-performance-scaling.aspx</link><pubDate>Tue, 19 Feb 2013 15:56:27 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3553560</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3553560</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2013/02/19/content-processing-performance-scaling.aspx#comments</comments><description>&lt;p&gt;SharePoint 2013 has added the Content Processing Service to handle preparing documents to be indexed by the search engine.&amp;#160; One feature of the CPS is that it will adjust the number of processing flows depending on the number of physical cores present.&amp;#160; From the &lt;a href="http://technet.microsoft.com/en-us/library/cc262787.aspx"&gt;2013 boundaries page&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;If the number of physical cores on the host equals N, then the Content processing component will have N*K feeding sessions. K is a constant coefficient with the initial value 3. A 4-core server will have 12 feeding sessions, which means that the Content processing component can process 12 documents in parallel. You can change the value of K by setting the &lt;b&gt;NumberOfCssFeedersPerCPUForRegularCrawl&lt;/b&gt; property of the Search Service Application. SharePoint 2013 limits the value of N upwards to 12, even if a server has more than 12 physical cores. Therefore a 16-core server will have N*K = 12 * 3 = 36 feeding sessions. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Adjusting the K is done via PowerShell, as follows:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;PS C:\&amp;gt; $ssa = Get-SPEnterpriseSearchServiceApplication
PS C:\&amp;gt; $ssa.SetProperty(&lt;span class="str"&gt;&amp;quot;NumberOfCssFeedersPerCPUForRegularCrawl&amp;quot;&lt;/span&gt;, 4)
PS C:\&amp;gt; $ssa.GetProperty(&lt;span class="str"&gt;&amp;quot;NumberOfCssFeedersPerCPUForRegularCrawl&amp;quot;&lt;/span&gt;)
4&lt;/pre&gt;

&lt;p&gt;Note that this property doesn’t exist in the ssa’s property bag until the default has been changed (so calling GetProperty on the default ssa will return an error)&lt;/p&gt;

&lt;p&gt;To validate that your change has taken effect you can use the “Search Content Processing / Flow Instances Active” performance counter.&amp;#160; This number will grow or decrease as you change the value of K.&amp;#160;&amp;#160; It should be equal to the NumberOfCPUOnBox * NumberOfCssFeedersPerCPUForRegularCrawl.&amp;#160;&amp;#160; There may be times where you’ll see additional flows reported.&amp;#160; These most likely will be due to continuous crawl and are expected.&amp;#160;&amp;#160; This in turn can be confirmed by looking at the “Search Gatherer Content Plugin – SharePointServerSearch / … –Continous Crawl / CTS Sessions” counters. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3553560" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+2013/">SharePoint 2013</category></item><item><title>FS4SP Branding Project</title><link>http://blogs.technet.com/b/searchguys/archive/2013/01/21/fs4sp-branding-project.aspx</link><pubDate>Mon, 21 Jan 2013 03:39:54 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3547007</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3547007</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2013/01/21/fs4sp-branding-project.aspx#comments</comments><description>&lt;p&gt;In this post I’ll describe a technique for branding a FAST Search for SharePoint Search Center.&amp;#160; There are three places where branding changes are often made:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The master page.&amp;#160; The FAST Search Center is based on minimal.master and in this example I’ll just take a copy of that page and make a minor tweak to prove that it is my version that is being used.&amp;#160;&amp;#160; Alternatively you can &lt;a href="http://blog.drisgill.com/2010/09/converting-custom-sharepoint-2010.html"&gt;convert a v4 master page&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;The Search Main publishing layout page.&amp;#160; This defines the layout of the main search page with just the search box.&lt;/li&gt;    &lt;li&gt;The Search Results publishing layout page.&amp;#160; This defines the layout of the search results page.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;We’ll build this all using Visual Studio 2010 into a site collection feature that can be applied to any search center.&amp;#160; When the feature is activated, the search center will be applied and the publishing pages made active.&amp;#160; On deactivation, we’ll roll back our changes so the solution can be properly retracted.&amp;#160;&amp;#160; Lastly for good measure, we’ll add in some logging to the ULS.&lt;/p&gt;  &lt;p&gt;This won’t show any actual snazzy branding (I’m no UI designer).&amp;#160; I’ll just be adding a custom css file and enough changes to the templates to prove that the customized versions are being used.&lt;/p&gt;  &lt;!--more--&gt;  &lt;p&gt;1. Open Visual Studio 2010 (as administrator), and create a new project. File &amp;gt; New &amp;gt; Project…, choosing the Empty SharePoint Project template.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3301.clip_5F00_image001_5F00_15FB4215.png"&gt;&lt;img title="clip_image001" style="display: inline; background-image: none;" border="0" alt="clip_image001" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/7178.clip_5F00_image001_5F00_thumb_5F00_3B875027.png" width="644" height="364" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Verify your local site and choose &amp;quot;Deploy as farm solution&amp;quot; (we'll be logging to the ULS which you can't do as a sandboxed solution)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/6746.image_5F00_7BA82823.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/0876.image_5F00_thumb_5F00_01EEFEB2.png" width="606" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;2. Add the feature. Right click on MCSBranding\Features in the Solution Explorer and choose &amp;quot;Add Feature&amp;quot;. By default it will be called &amp;quot;Feature1&amp;quot;, right click and rename to &amp;quot;Branding&amp;quot; (or whatever you want to call it). In the Branding.feature designer, update the title and make sure to change the scope to &amp;quot;Site&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3884.clip_5F00_image003_5F00_7F855135.png"&gt;&lt;img title="clip_image003" style="display: inline; background-image: none;" border="0" alt="clip_image003" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/7181.clip_5F00_image003_5F00_thumb_5F00_4AE785AB.png" width="644" height="434" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. Add a module to hold the master page. Right click on the MCSBranding project in the Solution Explorer, Add &amp;gt; New Item…, choosing the &amp;quot;Module&amp;quot; template and naming it &amp;quot;MasterPage&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/8255.clip_5F00_image004_5F00_298A70C0.png"&gt;&lt;img title="clip_image004" style="display: inline; background-image: none;" border="0" alt="clip_image004" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/7103.clip_5F00_image004_5F00_thumb_5F00_74807240.png" width="644" height="367" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. Add our master page. In the Solution Explorer, go to MCSBranding\MasterPage and delete the Sample.txt file that was created by the template. Right click on MasterPage and choose Add &amp;gt; Existing…, navigate to your …14\TEMPLATE\LAYOUTS directory and choose minimal.master. Right click on &amp;quot;minimal.master&amp;quot; and rename to &amp;quot;mcs_minimal.master&amp;quot; (or whatever makes sense for you). The Solution Explorer at this point should look like:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/4188.clip_5F00_image005_5F00_27AF6DA6.png"&gt;&lt;img title="clip_image005" style="display: inline; background-image: none;" border="0" alt="clip_image005" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/6758.clip_5F00_image005_5F00_thumb_5F00_3EDD78D5.png" width="244" height="243" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In the MasterPage\Elements.xml (which should have been opened when you added the module), you now need to add some magic bits to make this page available as a master page.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Module&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MasterPage&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Url&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;_catalogs/masterPage&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;File&lt;/span&gt; &lt;span class="attr"&gt;Path&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MasterPage\mcs_minimal.master&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Url&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mcs_minimal.master&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;GhostableInLibrary&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Title&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MCS Master Page&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MasterPageDescription&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MCS Master Page&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ContentType&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;$Resources:cmscore,contenttype_masterpage_name;&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;File&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;If you want to make any changes specific to either the search main or results pages you'll need to add those publishing templates as well. THERE MUST BE A BETTER WAY TO DO THIS BUT HERE'S WHAT HAS WORKED FOR ME… Launch SharePoint Designer 2010 and open a site that already has an Enterprise FAST Search Center. Choose &amp;quot;Master Pages&amp;quot; in the Site Objects and you should see SearchMain.aspx and SearchResults.aspx. For each of them do the following: Right click and choose &amp;quot;Edit file in Advanced Mode&amp;quot;. Do not check the file out. Switch to &amp;quot;Code&amp;quot; mode and select everything. Copy and paste into your favorite text editor and save to C:\Projects\MCSSolution\MCSBranding\MasterPage adding a &amp;quot;mcs_&amp;quot; prefix.&lt;/p&gt;

&lt;p&gt;Next add SearchMain.aspx and SearchResults.aspx for us to customize. Right click on MasterPage again, Add &amp;gt; Existing…, navigate to …\MCSBranding\MasterPage and select both files to add at once. Back to the MasterPage\Elements.xml and these files also need some extra properties:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;File&lt;/span&gt; &lt;span class="attr"&gt;Path&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MasterPage\mcs_searchmain.aspx&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Url&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mcs_searchmain.aspx&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;GhostableInLibrary&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Title&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MCS Search Main&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MasterPageDescription&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Search Main for MCS&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ContentType&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;$Resources:cmscore,contenttype_pagelayout_name;&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;PublishingAssociatedContentType&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;;#Welcome Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4;#&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;File&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;File&lt;/span&gt; &lt;span class="attr"&gt;Path&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MasterPage\mcs_searchresults.aspx&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Url&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mcs_searchresults.aspx&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;GhostableInLibrary&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Title&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MCS Search Main&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MasterPageDescription&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Search Results for MCS&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ContentType&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;$Resources:cmscore,contenttype_pagelayout_name;&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;PublishingAssociatedContentType&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;;#Welcome Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4;#&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;File&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;5. Add a place for your branding elements. Since your branding solution will undoubtedly have custom style sheets and images, we'll next add a module to house them. Click to highlight MCSBranding and press Ctrl-Shift-A and add another Module and name it &amp;quot;mcsBranding&amp;quot; (or whatever you want).&lt;/p&gt;

&lt;p&gt;For this example, I'm just going to rename the sample.txt to mcs_branding.css which I'll add a reference to in my master page, inserting the following line just before the &amp;lt;/head&amp;gt; tag:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SharePoint:CssRegistration&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;lt;% $SPUrl:~SiteCollection/mcsBranding/mcs_branding.css %&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
For customizations in this example all I'm going to add is:&amp;#160; &lt;p&gt;Search main line 153:&amp;#160; &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mcs_main&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;MCS_SEARCHMAIN&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Search results line 128:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mcs_results&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;MCS_SEARCHRESULTS&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Mcs_minimal.master line 136:&amp;#160; &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;mcs_master&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;MCS_MASTER_PAGE&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;And for mcs_branding.css:&amp;#160; &lt;/p&gt;

&lt;p&gt;
  &lt;pre class="csharpcode"&gt;#mcs_master 
{
   font-weight: bold;
   color: Red;
}

#mcs_main 
{
   font-weight: bold;
   color: Green;
}

#mcs_results
{
   font-weight: bold;
   color: Blue;
}
  &lt;/pre&gt;
6. Feature Activation. Now comes the fun part. Thanks to my colleague Jeff Lyttle for the starter event receiver code that finally got me going on this, here's the setup that worked for me. Right click on your Branding feature and choose &amp;quot;Add Event Reciever&amp;quot;.&lt;/p&gt;

&lt;p&gt;Right click on the MCSBranding project and choose &amp;quot;Add reference&amp;quot;. Select .NET tab and add Microsoft.SharePoint.Publishing. Replace the existing block of using's with:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Runtime.InteropServices;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.SharePoint;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.SharePoint.Publishing;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.SharePoint.Administration;
&lt;/pre&gt;

&lt;p&gt;In the event reciever, select and delete the commented out FeatureActivated and FeatureDeactivating method stubs and replace with &lt;/p&gt;

&lt;p&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; FeatureActivated(SPFeatureReceiverProperties properties)
{
    LoggingService.LogMonitor(&lt;span class="str"&gt;&amp;quot;DarpaBranding entering FeatureActivated&amp;quot;&lt;/span&gt;);

    SPSite site = properties.Feature.Parent &lt;span class="kwrd"&gt;as&lt;/span&gt; SPSite;
    SPList masterPageGallery = site.GetCatalog(SPListTemplateType.MasterPageCatalog);
    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (SPListItem li &lt;span class="kwrd"&gt;in&lt;/span&gt; masterPageGallery.Items)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (li.File.Name.ToLower() == &lt;span class="str"&gt;&amp;quot;mcs_minimal.master&amp;quot;&lt;/span&gt; ||
            li.File.Name.ToLower() == &lt;span class="str"&gt;&amp;quot;mcs_searchmain.aspx&amp;quot;&lt;/span&gt; ||
            li.File.Name.ToLower() == &lt;span class="str"&gt;&amp;quot;mcs_searchresults.aspx&amp;quot;&lt;/span&gt; )
        {
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!li.HasPublishedVersion)
            {
                LoggingService.LogInfo(String.Format(&lt;span class="str"&gt;&amp;quot;Publishing {0}&amp;quot;&lt;/span&gt;, li.File.Name));
                li.File.CheckIn(&lt;span class="str"&gt;&amp;quot;Automatically checked in by MCS Branding feature&amp;quot;&lt;/span&gt;,
                SPCheckinType.MajorCheckIn);
                li.File.Update();
                li.File.Approve(&lt;span class="str"&gt;&amp;quot;Automatically approved by MCS Branding feature&amp;quot;&lt;/span&gt;);
                li.File.Update();
            }
        }
    }
    SPWeb web = site.RootWeb;
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (web.CustomMasterUrl.EndsWith(&lt;span class="str"&gt;&amp;quot;minimal.master&amp;quot;&lt;/span&gt;))
    {
        LoggingService.LogInfo(&lt;span class="str"&gt;&amp;quot;Applying our master page&amp;quot;&lt;/span&gt;);
        Uri masterUri = &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(web.Url + &lt;span class="str"&gt;&amp;quot;/_catalogs/masterpage/mcs_minimal.master&amp;quot;&lt;/span&gt;);
        web.CustomMasterUrl = masterUri.AbsolutePath;
        LoggingService.LogInfo(&lt;span class="str"&gt;&amp;quot;Applying custom publishing pages&amp;quot;&lt;/span&gt;);
        &lt;span class="rem"&gt;// register our search layout pages &lt;/span&gt;
        PageLayout[] allLayouts = AddPageLayout(web, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;[] { &lt;span class="str"&gt;&amp;quot;mcs_searchresults.aspx&amp;quot;&lt;/span&gt;,
                                                                    &lt;span class="str"&gt;&amp;quot;mcs_searchmain.aspx&amp;quot;&lt;/span&gt; });
        &lt;span class="rem"&gt;// set them on the search pages&lt;/span&gt;
        SetPublishingPageLayout(web, allLayouts, &lt;span class="str"&gt;&amp;quot;default.aspx&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;mcs_searchmain.aspx&amp;quot;&lt;/span&gt;);
        SetPublishingPageLayout(web, allLayouts, &lt;span class="str"&gt;&amp;quot;results.aspx&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;mcs_searchresults.aspx&amp;quot;&lt;/span&gt;);
        web.Update();
    }
}

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; FeatureDeactivating(SPFeatureReceiverProperties properties)
{
    SPSite site = properties.Feature.Parent &lt;span class="kwrd"&gt;as&lt;/span&gt; SPSite;
    SPWeb web = site.RootWeb;
    &lt;span class="rem"&gt;// roll back master page if needed&lt;/span&gt;
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (web.CustomMasterUrl.EndsWith(&lt;span class="str"&gt;&amp;quot;mcs_minimal.master&amp;quot;&lt;/span&gt;))
    {
        Uri masterUri = &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(web.Url + &lt;span class="str"&gt;&amp;quot;/_catalogs/masterpage/minimal.master&amp;quot;&lt;/span&gt;);
        web.CustomMasterUrl = masterUri.AbsolutePath;
    }
    &lt;span class="rem"&gt;// reset the page layouts so our customized files can be retracted&lt;/span&gt;
    PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web);
    PageLayout[] layouts = pubWeb.GetAvailablePageLayouts();
    SetPublishingPageLayout(web, layouts, &lt;span class="str"&gt;&amp;quot;default.aspx&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SearchMain.aspx&amp;quot;&lt;/span&gt;);
    SetPublishingPageLayout(web, layouts, &lt;span class="str"&gt;&amp;quot;results.aspx&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;SearchResults.aspx&amp;quot;&lt;/span&gt;);
    web.Update();
}
  &lt;/pre&gt;
You'll also need these helper methods. Paste at the bottom of the class:&amp;#160; &lt;/p&gt;

&lt;p&gt;
  &lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; PageLayout[] AddPageLayout(SPWeb currentWeb, &lt;span class="kwrd"&gt;string&lt;/span&gt;[] layoutNames)
        {
            PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(currentWeb);

            PageLayout[] layouts = pubWeb.GetAvailablePageLayouts();

            List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; layoutsToAdd = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();

            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; currentLayoutName &lt;span class="kwrd"&gt;in&lt;/span&gt; layoutNames)
            {
                var layoutExists = from PageLayout currentLayout &lt;span class="kwrd"&gt;in&lt;/span&gt; layouts
                                   &lt;span class="kwrd"&gt;where&lt;/span&gt; currentLayout.Name == currentLayoutName
                                   select currentLayout;

                &lt;span class="kwrd"&gt;if&lt;/span&gt; (layoutExists.Count() == 0)
                {
                    layoutsToAdd.Add(currentLayoutName);
                }
            }

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (layoutsToAdd.Count &amp;gt; 0)
            {
                List&amp;lt;PageLayout&amp;gt; newLayouts = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;PageLayout&amp;gt;();

                SPList masterPageList = currentWeb.GetCatalog(SPListTemplateType.MasterPageCatalog);

                List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; j = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();
                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (SPListItem r &lt;span class="kwrd"&gt;in&lt;/span&gt; masterPageList.Items)
                {
                    j.Add(r.Name);
                }
                j.Sort();
                &lt;span class="kwrd"&gt;string&lt;/span&gt;[] z = j.ToArray();

                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; currentLayoutToAdd &lt;span class="kwrd"&gt;in&lt;/span&gt; layoutsToAdd)
                {
                    SPListItem itemLayoutsToAdd = (from SPListItem currentItem &lt;span class="kwrd"&gt;in&lt;/span&gt; masterPageList.Items
                                                   &lt;span class="kwrd"&gt;where&lt;/span&gt; (currentItem.Name == currentLayoutToAdd)
                                                   select currentItem).First();

                    newLayouts.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; PageLayout(itemLayoutsToAdd));
                }

                List&amp;lt;PageLayout&amp;gt; newLayoutList = layouts.ToList();
                newLayoutList.AddRange(newLayouts);

                PageLayout[] newLayoutSet = newLayoutList.ToArray();

                pubWeb.SetAvailablePageLayouts(newLayoutSet, &lt;span class="kwrd"&gt;false&lt;/span&gt;);
                pubWeb.Update();
                currentWeb.Update();

                &lt;span class="kwrd"&gt;return&lt;/span&gt; newLayoutSet.ToArray();

            }
            &lt;span class="kwrd"&gt;else&lt;/span&gt;
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; layouts.ToArray();
            }

        }

        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SetPublishingPageLayout(SPWeb currentWeb, PageLayout[] existingLayouts, &lt;span class="kwrd"&gt;string&lt;/span&gt; pageName, &lt;span class="kwrd"&gt;string&lt;/span&gt; layoutName)
        {
            PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(currentWeb);

            PublishingPageCollection pubPages = pubWeb.GetPublishingPages();

            var pages = from PublishingPage currentPage &lt;span class="kwrd"&gt;in&lt;/span&gt; pubPages
                                &lt;span class="kwrd"&gt;where&lt;/span&gt; currentPage.Name == pageName
                                select currentPage;

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (pages.Count() == 0)
            {
                LoggingService.LogError(String.Format(&lt;span class="str"&gt;&amp;quot;Failed to find publishing page {0}&amp;quot;&lt;/span&gt;, pageName));
                &lt;span class="kwrd"&gt;return&lt;/span&gt;;
            }
            PublishingPage page = pages.First();

            var layouts = from PageLayout currentLayout &lt;span class="kwrd"&gt;in&lt;/span&gt; existingLayouts
                                        &lt;span class="kwrd"&gt;where&lt;/span&gt; currentLayout.Name == layoutName
                                        select currentLayout;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (layouts.Count() == 0) 
            {
                LoggingService.LogError(String.Format(&lt;span class="str"&gt;&amp;quot;Failed to find page layout {0}&amp;quot;&lt;/span&gt;, layoutName));
                &lt;span class="kwrd"&gt;return&lt;/span&gt;;
            }
            PageLayout layout = layouts.First();

            LoggingService.LogInfo(String.Format(&lt;span class="str"&gt;&amp;quot;Setting {0} layout to {1}&amp;quot;&lt;/span&gt;, pageName, layoutName));
            page.CheckOut();
            page.Layout = layout;
            page.Update();
            page.CheckIn(&lt;span class="str"&gt;&amp;quot;Added in by feature&amp;quot;&lt;/span&gt;);
            SPFile pageFile = page.ListItem.File;
            pageFile.Publish(&lt;span class="str"&gt;&amp;quot;Added in by feature&amp;quot;&lt;/span&gt;);
            LoggingService.LogInfo(String.Format(&lt;span class="str"&gt;&amp;quot;Publishing {0}&amp;quot;&lt;/span&gt;, pageName));
        }
    }
        




    &lt;span class="kwrd"&gt;class&lt;/span&gt; LoggingService : SPDiagnosticsServiceBase
    {
        &lt;span class="rem"&gt;// This is what shows up in the Product column of the ULS viewer&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; LOG_AREA = &lt;span class="str"&gt;&amp;quot;MCS Feature&amp;quot;&lt;/span&gt;;
        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; LoggingService _Current;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; LoggingService Current
        {
            get
            {
                &lt;span class="kwrd"&gt;if&lt;/span&gt; (_Current == &lt;span class="kwrd"&gt;null&lt;/span&gt;)
                {
                    _Current = &lt;span class="kwrd"&gt;new&lt;/span&gt; LoggingService();
                }
                &lt;span class="kwrd"&gt;return&lt;/span&gt; _Current;
            }

        }

        &lt;span class="kwrd"&gt;private&lt;/span&gt; LoggingService()
            : &lt;span class="kwrd"&gt;base&lt;/span&gt;(&lt;span class="str"&gt;&amp;quot;MCS Logging Service&amp;quot;&lt;/span&gt;, SPFarm.Local)
        {
        }

        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; IEnumerable&amp;lt;SPDiagnosticsArea&amp;gt; ProvideAreas()
        {
            List&amp;lt;SPDiagnosticsArea&amp;gt; areas = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;SPDiagnosticsArea&amp;gt;
            {
                &lt;span class="kwrd"&gt;new&lt;/span&gt; SPDiagnosticsArea(LOG_AREA, &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;SPDiagnosticsCategory&amp;gt;
                {
                    &lt;span class="kwrd"&gt;new&lt;/span&gt; SPDiagnosticsCategory(&lt;span class="str"&gt;&amp;quot;ERROR&amp;quot;&lt;/span&gt;, TraceSeverity.Unexpected, EventSeverity.Error),
                    &lt;span class="kwrd"&gt;new&lt;/span&gt; SPDiagnosticsCategory(&lt;span class="str"&gt;&amp;quot;INFO&amp;quot;&lt;/span&gt;, TraceSeverity.Verbose, EventSeverity.Information),
                    &lt;span class="kwrd"&gt;new&lt;/span&gt; SPDiagnosticsCategory(&lt;span class="str"&gt;&amp;quot;monitoring&amp;quot;&lt;/span&gt;, TraceSeverity.Medium, EventSeverity.Information)
                })
            };
            &lt;span class="kwrd"&gt;return&lt;/span&gt; areas;
        }

        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LogError(&lt;span class="kwrd"&gt;string&lt;/span&gt; errorMessage)
        {
            LogError(errorMessage, 0);
        }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LogError(&lt;span class="kwrd"&gt;string&lt;/span&gt; errorMessage, &lt;span class="kwrd"&gt;ushort&lt;/span&gt; id)
        {
            &lt;span class="kwrd"&gt;string&lt;/span&gt; categoryName = &lt;span class="str"&gt;&amp;quot;ERROR&amp;quot;&lt;/span&gt;;
            SPDiagnosticsCategory category = LoggingService.Current.Areas[LOG_AREA].Categories[categoryName];
            LoggingService.Current.WriteTrace(id, category, TraceSeverity.Unexpected, errorMessage);
        }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LogInfo(&lt;span class="kwrd"&gt;string&lt;/span&gt; infoMessage)
        {
            LogInfo(infoMessage, 0);
        }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LogInfo(&lt;span class="kwrd"&gt;string&lt;/span&gt; infoMessage, &lt;span class="kwrd"&gt;ushort&lt;/span&gt; id)
        {
            &lt;span class="kwrd"&gt;string&lt;/span&gt; categoryName = &lt;span class="str"&gt;&amp;quot;INFO&amp;quot;&lt;/span&gt;;
            SPDiagnosticsCategory category = LoggingService.Current.Areas[LOG_AREA].Categories[categoryName];
            LoggingService.Current.WriteTrace(id, category, TraceSeverity.Verbose, infoMessage);
        }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LogMonitor(&lt;span class="kwrd"&gt;string&lt;/span&gt; infoMessage)
        {
            LogMonitor(infoMessage, 0);
        }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LogMonitor(&lt;span class="kwrd"&gt;string&lt;/span&gt; infoMessage, &lt;span class="kwrd"&gt;ushort&lt;/span&gt; id)
        {
            &lt;span class="kwrd"&gt;string&lt;/span&gt; categoryName = &lt;span class="str"&gt;&amp;quot;monitoring&amp;quot;&lt;/span&gt;;
            SPDiagnosticsCategory category = LoggingService.Current.Areas[LOG_AREA].Categories[categoryName];
            LoggingService.Current.WriteTrace(id, category, TraceSeverity.Medium, infoMessage);
        }

    }
  &lt;/pre&gt;
7. Deploy it! Right click on the MCSBranding project and choose Deploy. (note: if your test farm has multiple WFE servers this will error out with the error &amp;quot;Error occurred in deployment step 'Activate Features': Feature with Id 'GUID' is not installed in this farm, and cannot be added to this scope.&amp;quot;… apparently that's a known issue and you'll have to then go to Central Admin &amp;gt; System Settings &amp;gt; Manage Farm Solutions and deploy the solution manually.)&lt;/p&gt;

&lt;p&gt;Now over to your FAST Search Center and to Site Settings -&amp;gt; Site Collection Features and you should see your feature ready to be activated:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/5531.clip_5F00_image006_5F00_47FC63BC.png"&gt;&lt;img title="clip_image006" style="display: inline; background-image: none;" border="0" alt="clip_image006" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/8686.clip_5F00_image006_5F00_thumb_5F00_6334BCBD.png" width="644" height="30" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &amp;quot;Activate&amp;quot; and if everything works you should just see that it has now been activated. If you were running the ULS Viewer you can filter by the Product &amp;quot;MCS Feature&amp;quot; and should be rewarded with:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/0741.clip_5F00_image007_5F00_6C244EFC.png"&gt;&lt;img title="clip_image007" style="display: inline; background-image: none;" border="0" alt="clip_image007" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/5050.clip_5F00_image007_5F00_thumb_5F00_743B7B51.png" width="644" height="227" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if you go to the search home page you should see your customizations.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/2235.clip_5F00_image008_5F00_7EFDF408.png"&gt;&lt;img title="clip_image008" style="display: inline; background-image: none;" border="0" alt="clip_image008" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3817.clip_5F00_image008_5F00_thumb_5F00_279C6010.png" width="644" height="316" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And on the results page:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3312.clip_5F00_image009_5F00_0B8E31D6.png"&gt;&lt;img title="clip_image009" style="display: inline; background-image: none;" border="0" alt="clip_image009" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3817.clip_5F00_image009_5F00_thumb_5F00_36D5598E.png" width="644" height="379" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3547007" width="1" height="1"&gt;</description></item><item><title>Getting the current user’s alias</title><link>http://blogs.technet.com/b/searchguys/archive/2012/12/03/getting-the-current-user-s-alias.aspx</link><pubDate>Mon, 03 Dec 2012 21:21:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3536178</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3536178</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2012/12/03/getting-the-current-user-s-alias.aspx#comments</comments><description>&lt;p&gt;For a project I&amp;rsquo;m working on, I needed to know what the logged in user&amp;rsquo;s account alias was.&amp;nbsp; Looking around I found examples that would make a ajax call out to the profile page and parse the results.&amp;nbsp; This seemed like overkill for what I wanted and on a whim I decided to view-source on the Search Center results page and search for my user name&amp;hellip; Sure enough, there it is:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/6862.accountname_5F00_296DF216.png"&gt;&lt;img style="display: inline; background-image: none;" title="accountname" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3632.accountname_5F00_thumb_5F00_4FCFD561.png" alt="accountname" width="642" height="145" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The hidden QLogEnv inputs are used to click event tracking but this is good enough for me.&amp;nbsp;&amp;nbsp; Here&amp;rsquo;s the JQuery I used to pull it out:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New;"&gt;function pullAlias() { &lt;br /&gt;&amp;nbsp; // Pull the alias or return null &lt;br /&gt;&amp;nbsp; var p = /&amp;lt;un&amp;gt;[a-zA-Z]+\\([^&amp;lt;]+)/; &lt;br /&gt;&amp;nbsp; var l = $('input').map(function(index) { &lt;br /&gt;&amp;nbsp; if (this.name.startsWith("QLogEnv") &amp;amp;&amp;amp; (this.value.indexOf("&amp;lt;un&amp;gt;") != -1)) { &lt;br /&gt;&amp;nbsp;&amp;nbsp; var r = p.exec(this.value); &lt;br /&gt;&amp;nbsp;&amp;nbsp; if (r) { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return r[1] &lt;br /&gt;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&amp;nbsp; } &lt;br /&gt;&amp;nbsp; }) &lt;br /&gt;&amp;nbsp; if (!l) { return } // no alias found? &lt;br /&gt;&amp;nbsp; return l[0] &lt;br /&gt; } &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3536178" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/FAST+Search/">FAST Search</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/Search+Center/">Search Center</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+2010/">SharePoint 2010</category></item><item><title>Managing the SP Gatherer's temp files</title><link>http://blogs.technet.com/b/searchguys/archive/2012/09/18/managing-the-sp-gatherer-s-temp-files.aspx</link><pubDate>Tue, 18 Sep 2012 18:41:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3520892</guid><dc:creator>Matt King - Search</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3520892</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2012/09/18/managing-the-sp-gatherer-s-temp-files.aspx#comments</comments><description>&lt;p&gt;While the SharePoint Gatherer is processing files (Office documents, PDFs, etc), it will store them temporarily on local disk.&amp;nbsp; By default this is in the Temp folder of the user running the OSearch14 service.&amp;nbsp; It'll look something like:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;C:\Users\SHAREP~1\AppData\Local\Temp\gthrsvc_OSearch14&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And during a large crawl, this directory can at times get quite large.&amp;nbsp; (as I found out today when a dev server started complaining abou the C drive being full)&lt;/p&gt;
&lt;p&gt;Moving it is easy enough and there are 2 ways.&lt;/p&gt;
&lt;p&gt;First, update the service application:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;$searchapp= Get-SPEnterpriseSearchServiceApplication -identity "FAST Content SSA"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;$searchapp.TempPath = "D:\SearchTemp"&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Note that setting the path takes effect immediately.&amp;nbsp; No need to call the $searchapp.Update() method.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE 5/17/2013&lt;/strong&gt;&lt;br /&gt;If you use the SSA.TempPath approach and have multiple crawlers, you need to make sure to run the command on each server anyway.&lt;/p&gt;
&lt;p&gt;Second approach is to update the registry directly:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;$gmpath = &lt;span style="font-family: Courier New;"&gt;'HKLM:\Software\Microsoft\Office Server\14.0\Search\Global\Gathering Manager'&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;Set-ItemProperty -Path $gmpath -Name UseSystemTemp -Value 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;Set-ItemProperty -Path&amp;nbsp;$gmpath -Name TempPath -Value "D:\SearchTemp"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;Restart-Service OSearch14&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And don't forget to exclude the new temp folder from any AV scans.&lt;/p&gt;
&lt;p&gt;(Thanks Sreedhar)&lt;/p&gt;
&lt;p&gt;Reference&lt;/p&gt;
&lt;p&gt;&lt;a href="http://technet.microsoft.com/en-us/library/ee513078.aspx" target="_blank"&gt;http://technet.microsoft.com/en-us/library/ee513078.aspx&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3520892" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/Quick+Hits/">Quick Hits</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/SharePoint+Crawler/">SharePoint Crawler</category></item><item><title>Anti-Virus settings and Pipeline Extensibility</title><link>http://blogs.technet.com/b/searchguys/archive/2012/08/21/anti-virus-settings-and-pipeline-extensibility.aspx</link><pubDate>Tue, 21 Aug 2012 20:26:03 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3515526</guid><dc:creator>Paul Branson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3515526</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2012/08/21/anti-virus-settings-and-pipeline-extensibility.aspx#comments</comments><description>&lt;p&gt;If you’re using Pipeline Extensibility in Fast Search for SharePoint, you may know that files are written to a local directory for your program to work on before getting dumped back into the pipeline.&amp;nbsp; This directory is:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&amp;lt;Fast user’s home directory&amp;gt;\AppData\LocalLow&lt;/pre&gt;   &lt;p&gt;Assuming you haven’t changed the location of the home directory, this would be:&lt;/p&gt;&lt;pre class="csharpcode"&gt;C:\Users\&amp;lt;your Fast user&amp;gt;\AppData\LocalLow&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&amp;nbsp;&lt;/pre&gt;   &lt;h4&gt;Want to see proof that this directory is used?&lt;/h4&gt;  &lt;p&gt;If you want to see the files accumulate here (dev only of course), edit $FASTSEARCH\etc\pipelineextensibility.xml and add a ‘–logging enable’ parameter to the Run command.&amp;nbsp; Your new command should look something like this:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&amp;lt;Run command=&lt;span class="str"&gt;"yourbinary.exe"&lt;/span&gt; %(input)s %(output)s -logging enable"&amp;gt;&lt;/pre&gt;Save the file and run ‘psctrl reset’.&amp;nbsp; This will reset all your item processors and read in the new config.&amp;nbsp; Start a new crawl and watch the .txt files start showing up in that directory.&amp;nbsp; When you’re done, change ‘enable’ to ‘disable’ to turn it back off.&lt;p&gt;My point here is that lots of txt files are writing to this directory.&amp;nbsp; If you follow the anti-virus configuration settings found on &lt;a href="http://technet.microsoft.com/en-us/library/ff381239.aspx" target="_blank"&gt;TechNet&lt;/a&gt;, you won’t see this directory listed.&amp;nbsp; If you’re following the recommendations on that page and still see your AV running high, this could be it.&amp;nbsp; You may want to add your executable to the list of processes to exclude as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3515526" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/b/searchguys/archive/tags/FAST+Search/">FAST Search</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/Anti_2D00_Virus/">Anti-Virus</category><category domain="http://blogs.technet.com/b/searchguys/archive/tags/Pipeline+Extensibility/">Pipeline Extensibility</category></item><item><title>Getting Refiner Counts Back in SharePoint 2013 Search</title><link>http://blogs.technet.com/b/searchguys/archive/2012/08/16/getting-refiner-counts-back-in-sharepoint-2013-search.aspx</link><pubDate>Thu, 16 Aug 2012 15:14:05 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3514733</guid><dc:creator>Paul Branson</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.technet.com/b/searchguys/rsscomments.aspx?WeblogPostID=3514733</wfw:commentRss><comments>http://blogs.technet.com/b/searchguys/archive/2012/08/16/getting-refiner-counts-back-in-sharepoint-2013-search.aspx#comments</comments><description>&lt;p&gt;If you’ve taken a look at search in 2013 at all, you might have noticed the beloved counts are now gone from refiner counts.&amp;#160; These were first introduced with Fast Search for SharePoint and represent what’s called deep refiners – that is- an accurate count of a refiner value from the entire corpus of data associated with your query.&amp;#160; The alternative, just so you know, are shallow refiners which create refiners off the top X number of search results instead of all search results.&lt;/p&gt;  &lt;p&gt;** Quick Note ** – this is being done with Beta bits.&amp;#160; I’ll update this later if the RTM version ends up being different.&lt;/p&gt;  &lt;p&gt;So first off, the counts were removed for a reason.&amp;#160; Studies showed that while it may be nice to see them, they weren’t actually used that much by users.&amp;#160; For example, if you’re looking for a Word document and use the refiners panel to narrow your search results, does it really matter that you’re going to narrow your results down to 58,245 results?&lt;/p&gt;  &lt;p&gt;But… you’re here because you want them back, so here’s how you do it:&lt;/p&gt;  &lt;p&gt;Here’s what it looks like by default.&amp;#160; No counts:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3005.image_5F00_43FC28C8.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3010.image_5F00_thumb_5F00_633ECF9B.png" width="131" height="342" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As you can see I have three refiners, but the top two don’t have count values.&amp;#160; For this, I’m going to add the count values to Author.&lt;/p&gt;  &lt;p&gt;The first step is understanding what controls the look and feel of the refiners themselves.&amp;#160; In Fast Search for SharePoint it was all controlled in XSLT.&amp;#160; In 2013, it’s controlled by Display Templates.&amp;#160; When you edit the Refinement Panel, you’ll now see this handy refiner chooser:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/6076.image_5F00_05E94E20.png"&gt;&lt;img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3240.image_5F00_thumb_5F00_3774BBB5.png" width="135" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click on Choose Refiners and you’ll get the following:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/7633.image_5F00_6F46FFD8.png"&gt;&lt;img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/4401.image_5F00_thumb_5F00_3557BCEC.png" width="192" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In the picture above, I’ve already selected my DisplayAuthor refiner and highlighted the associated Display Template called Refinement Item.&amp;#160; This is what we need to change.&lt;/p&gt;  &lt;p&gt;Display Templates are stored in the Master Page Gallery.&amp;#160; There’s multiple ways to find this next bit of info, but what I do is start by going to the new Design Manager and selecting Edit Display Templates:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/4401.image_5F00_6D2A010F.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3324.image_5F00_thumb_5F00_116EE592.png" width="244" height="67" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That will get you to the page where you can find the template you’re looking based on the name we saw in the refiner picker page (Refinement Item).&amp;#160; From here we can locate the actual home of the template.&amp;#160; Select the Open Menu (the 3 dots) and grab the location in the box.&amp;#160; For me it’s http://search.contoso.com/_catalogs/masterpage/Display Templates/Filters/Filter_Default.html.&amp;#160; &lt;/p&gt;  &lt;p&gt;Going to that location, I find my files:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/7041.image_5F00_779AAF62.png"&gt;&lt;img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/7127.image_5F00_thumb_5F00_1D905FB9.png" width="244" height="37" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;From here you have two options: (1) edit the OOTB template, or (2) create a copy and make a new one.&amp;#160; I’m going to select option 2 so I don’t muck with the original.&amp;#160; Just download a copy of Filter_Default.html to any location, and use your favorite HTML editor (aka: notepad) to open it up.&amp;#160; Once in, you’re looking for this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3733.image_5F00_5CEE1349.png"&gt;&lt;img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/8688.image_5F00_thumb_5F00_47905DE1.png" width="244" height="52" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;To get the counts back, you guessed it, just change the ShowCounts value to true.&amp;#160; Once changed, saved the file as a new name.&amp;#160; I used Filter_Default_with_counts.html.&amp;#160; Now head back to the same page you downloaded the original from, and upload the new file to the same library (Files tab on top –&amp;gt; Upload Document).&amp;#160; You’ll get a dialog when you upload to add metadata and give it a pretty name that you’ll see in the UI.&amp;#160; I used ‘Refinement Item With Counts’.&amp;#160; Once you upload it, you’ll notice it auto generates the associated .js.&amp;#160; This is good, and you don’t need to worry about what it’s doing (maybe more on that in a future post).&amp;#160; Here’s what you should now see:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/6064.image_5F00_269CEB3A.png"&gt;&lt;img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/6567.image_5F00_thumb_5F00_0CC8B50B.png" width="244" height="72" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Be sure to now check in the new .html file.&amp;#160; Just click the little arrow to the right when hovering over it and you’ll see the check in option.&lt;/p&gt;  &lt;p&gt;Now it’s just a matter of using this new template.&amp;#160; Jump back to your Search Hub, edit the page when you see the refiner, edit the Refinement web part, select the Choose Refiners, pick your refiner (Display Author for me), and select the Display template drop down.&amp;#160;&amp;#160; Bam!&amp;#160; There it is:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/4807.image_5F00_45072C23.png"&gt;&lt;img title="image" style="margin: 0px; display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/1754.image_5F00_thumb_5F00_247FEC71.png" width="244" height="106" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select that, save everything, and check your refiner with another search:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/3021.image_5F00_229C832C.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-93-78-metablogapi/4087.image_5F00_thumb_5F00_0215437A.png" width="130" height="344" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Voila!&amp;#160; Counts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3514733" width="1" height="1"&gt;</description></item></channel></rss>