<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Search Nuggets &#187; sp2010</title>
	<atom:link href="http://blog.comperiosearch.com/blog/tag/sp2010/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.comperiosearch.com</link>
	<description>A blog about Search as THE solution</description>
	<lastBuildDate>Mon, 13 Jun 2016 08:59:45 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>How FS4SP primary keys work</title>
		<link>http://blog.comperiosearch.com/blog/2011/12/18/fs4sp-primary-keys-work/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/12/18/fs4sp-primary-keys-work/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 12:03:22 +0000</pubDate>
		<dc:creator><![CDATA[Marcus Johansson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fastsearch]]></category>
		<category><![CDATA[fs4sp]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/?p=733</guid>
		<description><![CDATA[Just like in most systems that contains data, each indexed content item in FAST Search for SharePoint (FS4SP) is associated with a certain primary key. No surprises here – in order to update or remove an item from the index, the system must be able to uniquely identify it. For the most part, Microsoft has [...]]]></description>
				<content:encoded><![CDATA[<p>Just like in most systems that contains data, each indexed content item in FAST Search for SharePoint (FS4SP) is associated with a certain primary key. No surprises here – in order to update or remove an item from the index, the system must be able to uniquely identify it.</p>
<p>For the most part, Microsoft has done a great job integrating FAST into the SharePoint world, but there are certainly some areas where you notice there are actually two paradigms behind the scene: how things work in SharePoint, and how things (used to) work in FAST.</p>
<p>The primary key of the FS4SP index is one of those areas. In this post, I’ll try to make this a little more understandable.</p>
<p>First of all, the place where most people will notice that a primary key actually exists is in the crawl log on the FAST Content SSA.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/12/Untitled.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="Untitled" src="http://blog.comperiosearch.com/wp-content/uploads/2011/12/Untitled_thumb.png" border="0" alt="Untitled" width="536" height="238" /></a></p>
<p>Each indexed item is assigned an auto-incremented integer referred to as Item ID. All right, so let’s dig a little deeper.</p>
<p>If you’ve been reading up on FS4SP, you probably already know that there is an internal FAST-process called “qrserver”. It is responsible for receiving queries from the FAST Query SSA and internally forwarding the query to the actual index. You might also know that this process exposes a small web interface. For security reasons, it’s only available from within the server it runs on. More specifically: <a href="http://localhost:13280">http://localhost:13280</a>.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image_thumb.png" border="0" alt="image" width="527" height="335" /></a></p>
<p>Searching for something here will return results in an internal XML format. The actual result items are listed under the &lt;RESULTSET&gt; tag a bit down in the XML. There are lots of things to talk about here, e.g. that the naming convention used internally in FAST is quite different to what is used when the results come back through the FAST Query SSA. A managed property for example, is referred to as a “field” internally. But let’s not fret over that now. Instead, let’s look at the first few properties of the first result:</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image1.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image_thumb1.png" border="0" alt="image" width="569" height="63" /></a></p>
<p>After a few quick comparisons of the crawl log on the FAST Content SSA and the search results from the qrserver, it’s clear that the Item ID is stored in FS4SP’s index inside the property <strong>contentid</strong>. When comparing with the Item IDs listed on the FAST Content SSA, we also notice that SharePoint is prefixing the Item ID with “ssic://” when it&#8217;s stored in the index. In other words, the <em>true</em> primary key as used internally, is based on the pattern “ssic://[auto-incremented integer]”.</p>
<p>But as anyone who’s been using FAST pre-Microsoft can tell you, the contentid is actually <em>not</em> the primary key of the index. The real primary key is what’s stored inside the property <strong>internalid</strong>. The value of this property is the MD5 digest of the contentid, concatenated with the name of the content collection it is stored in. Let’s double-check, using our example. We had these two:</p><pre class="crayon-plain-tag">&amp;lt;FIELD NAME=&quot;internalid&quot;&amp;gt;8a832873c701c00135ce827d6c64c09c_sp&amp;lt;/FIELD&amp;gt;
&amp;lt;FIELD NAME=&quot;contentid&quot;&amp;gt;ssic://33&amp;lt;/FIELD&amp;gt;</pre><p>Calculating the MD5 digest of the contentid correctly yields the internalid (sans the collection suffix):</p><pre class="crayon-plain-tag">md5(&ldquo;ssic://33&rdquo;) == &ldquo;8a832873c701c00135ce827d6c64c09c&rdquo;</pre><p>Since the internalid is suffixed with the name of the collection, we can actually put several items with the same contentid into the index. The requirement being that they’re stored in separate collections, so that the concatenated internalid value becomes unique. In FS4SP however, we often use only the default “sp” collection. Luckily, SharePoint makes sure to assign the Item IDs so that they’re unique across all collections, hence creating unique internalid:s even though the items are in the same collection.</p>
<p>However, there are ways in FS4SP to index data without going through the FAST Content SSA, i.e. you can index data without letting SharePoint know about it. This happens when you’re using any of the <a href="http://technet.microsoft.com/en-us/library/ff383272.aspx">FAST Search specific connectors</a> or the command-line tool <a href="http://technet.microsoft.com/en-us/library/ee943508.aspx">docpush</a>. These tools talk directly with the index, bypassing SharePoint completely. Thus, the content id item won’t be assigned an Item ID using the “ssic://” pattern.</p>
<p>So, what happens instead? Let’s try it out. Using the docpush tool, we can send an arbitrary web page into the index:</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image2.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image_thumb2.png" border="0" alt="image" width="563" height="102" /></a></p>
<p>Using the qrserver web interface, we inspect what was indexed:</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image3.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/12/image_thumb3.png" border="0" alt="image" width="544" height="80" /></a></p>
<p>In this case, the contentid property is the URL of the web page we specified. This makes sense as the URL is unique for the whole web, and as such it is also a good candidate for being a primary key in the index. A URL is just a special case of a URI, which is what many of the <a href="http://technet.microsoft.com/en-us/library/ee943520.aspx">FS4SP command-line tools</a> use when referring to the primary key of the index. Examples being the docpush tool (when deleting a item from the index with the –d switch) and the waadmin tool (used for retrieving link cardinality data for an indexed item).</p>
<p>To sum up with some key points:</p>
<ul>
<li>The primary key of the index is stored in a property called <strong>contentid</strong>, though in the SharePoint GUIs it is referred to as an <strong>Item ID</strong> and look slightly different. They relate to one another as: [contentid] = ssic://[item id]</li>
<li>Items that are indexed using the connectors of the FAST Content SSA are assigned a contentid on the form “ssic://”…</li>
<li>Items that are indexed with the FAST Search specific connectors or the docpush tool do not follow the same pattern, but are typically a proper URL or a value from a database.</li>
<li>If a command-line tool calls for a “URI” to an indexed item, use whatever is stored in the item’s contentid property.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/12/18/fs4sp-primary-keys-work/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Deleting a Federated Location via the API</title>
		<link>http://blog.comperiosearch.com/blog/2011/06/22/deleting-a-federated-location-via-the-api/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/06/22/deleting-a-federated-location-via-the-api/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 12:51:00 +0000</pubDate>
		<dc:creator><![CDATA[Mikael Svenson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/2011/06/deleting-a-federated-location-via-the-api/</guid>
		<description><![CDATA[I’m working on a SharePoint feature which will automatically add a federated search location on feature activation and which will delete it on de-activation. To accomplish this I use the Microsoft.Office.Server.Search.Administration.SearchServiceApplication class, and more specifically the AddNewLocationConfiguration and DeleteLocationConfiguration methods. I tried to use the same methods of the SearchServiceApplicationProxy first, but there seems to [...]]]></description>
				<content:encoded><![CDATA[<p>I’m working on a SharePoint feature which will automatically add a federated search location on feature activation and which will delete it on de-activation.</p>
<p>To accomplish this I use the <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.server.search.administration.searchserviceapplication.aspx">Microsoft.Office.Server.Search.Administration.SearchServiceApplication</a> class, and more specifically the <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.server.search.administration.searchserviceapplication.addnewlocationconfiguration.aspx">AddNewLocationConfiguration</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.server.search.administration.searchserviceapplication.deletelocationconfiguration.aspx">DeleteLocationConfiguration</a> methods. I tried to use the same methods of the SearchServiceApplicationProxy first, but there seems to be an error using the AddNewLocationConfiguration method on proxy object.</p>
<p>AddNewLocationConfiguration takes a LocationConfiguration object as parameter, which can be created by loading in the xml from an OSDX file like this:</p>
<p><span style="font-family: 'Courier New'; font-size: small;">var searchLocation = new LocationConfiguration();<br />
var stream = …stream to xml file…;<br />
searchLocation.Import(stream);</span></p>
<p>As you see, adding is not too hard, but deleting is the problem. The DeleteLocationConfiguration method takes the id of a LocationConfiguration object as the parameter. But lo and behold, the Id property is defined as internal.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/06/image1.png" border="0" alt="image" width="497" height="366" /></p>
<p><span id="more-535"></span>That means it’s not available for us to delete on. But we’re lucky to use .Net where reflection is possible. Buy using the helper class below we can get the value from the internal property. Note that the code could have used regular reflection, but emitting IL makes more optimized code, and I use this utility class a lot of other places where performance is an issue.</p>
<div>
<pre class="crayon-plain-tag">&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; DynamicReflectionHelperforObject&amp;lt;V&amp;gt;{
    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;delegate&lt;/span&gt; T GetPropertyFieldDelegate&amp;lt;T&amp;gt;(V obj);

    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;static&lt;/span&gt; GetPropertyFieldDelegate&amp;lt;C&amp;gt; GetP&amp;lt;C&amp;gt;(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; memberName)
    {
        Type v = &lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(V);
        PropertyInfo pi = v.GetProperty(memberName, BindingFlags.NonPublic | BindingFlags.Instance);
        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (pi == &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;)
            &lt;span class=&quot;kwrd&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; NullReferenceException(&lt;span class=&quot;str&quot;&gt;&quot;No Property or Field&quot;&lt;/span&gt;);

        DynamicMethod dm = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; DynamicMethod(&lt;span class=&quot;str&quot;&gt;&quot;GetPropertyorField_&quot;&lt;/span&gt; + memberName, &lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(C), &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Type[] { v }, v.Module);        ILGenerator il = dm.GetILGenerator();
        il.Emit(OpCodes.Ldarg_0); &lt;span class=&quot;rem&quot;&gt;// loaded c, c is the return value
&lt;/span&gt;        il.EmitCall(OpCodes.Call, pi.GetGetMethod(&lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;), &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;);
        il.Emit(OpCodes.Ret);
        &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; (GetPropertyFieldDelegate&amp;lt;C&amp;gt;)dm.CreateDelegate(&lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(GetPropertyFieldDelegate&amp;lt;C&amp;gt;));
    }
}</pre>
</div>
<div>And to use it pass inn the object type, the property type and the object we want to retrieve the property from:</div>
<div>
<div id="codeSnippetWrapper">
<pre class="crayon-plain-tag">&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; id = Helpers.DynamicReflectionHelperforObject&amp;lt;LocationConfiguration&amp;gt;
   .GetProperty&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt;&amp;gt;(&lt;span class=&quot;str&quot;&gt;&quot;Id&quot;&lt;/span&gt;)
   .Invoke(frontLocation);
fastQuerySSA.DeleteLocationConfiguration(id);</pre>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/06/22/deleting-a-federated-location-via-the-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Document Thumbnails and PowerPoint Preview for your search results without installing FAST for SharePoint</title>
		<link>http://blog.comperiosearch.com/blog/2011/05/14/document-thumbnails-and-powerpoint-preview-for-your-search-results-without-installing-fast-for-sharepoint/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/05/14/document-thumbnails-and-powerpoint-preview-for-your-search-results-without-installing-fast-for-sharepoint/#comments</comments>
		<pubDate>Sat, 14 May 2011 11:17:20 +0000</pubDate>
		<dc:creator><![CDATA[Mikael Svenson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[fs4sp]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/2011/05/document-thumbnails-and-powerpoint-preview-for-your-search-results-without-installing-fast-for-sharepoint/</guid>
		<description><![CDATA[[Originally posted at: http://techmikael.blogspot.com/2011/05/document-thumbnails-and-powerpoint.html] Microsoft offers three different flavors of search for SharePoint 2010: Foundation, Standard and Enterprise. For each level upwards you get more feature and better search capabilities. One of the visual features included with FAST for SharePoint is Thumbnails and Previews for the search results, as listed on the comparison table below (Compare [...]]]></description>
				<content:encoded><![CDATA[<p><em>[Originally posted at: <a title="Tech And Me" href="http://techmikael.blogspot.com/2011/05/document-thumbnails-and-powerpoint.html">http://techmikael.blogspot.com/2011/05/document-thumbnails-and-powerpoint.html</a>]</em></p>
<p>Microsoft offers three different flavors of search for SharePoint 2010: Foundation, Standard and Enterprise. For each level upwards you get more feature and better search capabilities. One of the visual features included with FAST for SharePoint is Thumbnails and Previews for the search results, as listed on the comparison table below (<a href="http://sharepoint.microsoft.com/en-us/buy/Pages/Editions-Comparison.aspx?Capability=Search">Compare SharePoint Editions – Search</a>).</p>
<p>Wouldn’t it be nice to have this feature on all versions of SharePoint? I will tell you how, as I demonstrated in a proof of concept talk at <a href="http://www.arcticsharepointchallenge.com/">Arctic SharePoint Challenge 2011</a>.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="2011-04-28-Search-Thumbs-Preview-1" src="http://blog.comperiosearch.com/wp-content/uploads/2011/05/2011-04-28-Search-Thumbs-Preview-1.png" border="0" alt="2011-04-28-Search-Thumbs-Preview-1" width="504" height="410" /></p>
<p>The Thumbnail and Preview feature is depending on <a href="http://office.microsoft.com/en-us/web-apps/">Office Web Apps</a>, which is an additional module you can install on all versions of SharePoint 2010 in order to get web based editing capabilities of Office documents (Word, Excel, PowerPoint and OneNote). Office Web Apps itself is free, but requires Volume Licensing for Microsoft Office 2010.</p>
<p>The API’s used for generating the thumbnails and the PowerPoint previews are the <a href="http://download.microsoft.com/download/1/6/F/16F4E321-AA6B-4FA3-8AD3-E94C895A3C97/%5BMS-OMPWHP%5D.pdf">Office Mobile PowerPoint Web Handler Protocol</a> and the <a href="http://download.microsoft.com/download/1/6/F/16F4E321-AA6B-4FA3-8AD3-E94C895A3C97/%5BMS-OMWWH%5D.pdf">Office Mobile Word Web Handler Protocol</a>, both included with Office Web Apps. These API’s include functions to retrieve generated images of the documents as well as functions to retrieve the textual content within the documents. The API works for doc, docx, ppt and pptx files (Office 97-2010 formats).</p>
<p>The Word API is limited to generating a thumbnail for the first page in your document, while the PowerPoint API can generate an image of any slide as seen below.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="2011-04-28-Search-Thumbs-Preview-2" src="http://blog.comperiosearch.com/wp-content/uploads/2011/05/2011-04-28-Search-Thumbs-Preview-2.png" border="0" alt="2011-04-28-Search-Thumbs-Preview-2" width="504" height="335" /></p>
<p>If you have installed the Enterprise version of SharePoint you have the possibility to create a new Search Center based on the “<em>FAST Search Center</em>” template, even though FAST is not installed.</p>
<p>The FAST Search Center template features XSLT in the Core Results Web Part which renders javascript calls to functions in a file called <em>search.js</em> located in the <em>_layouts</em> folder. Search.js further implements the communication with the mobile API’s to generate the images.</p>
<p>There are quite a few lines of javascript to implement this feature, but if you are a bit experienced with javascript and ajax programming you would be able to program this feature yourself. This will allow you to get thumbnails and PowerPoint previews with any version of SharePoint, from the free Foundation version to the Enterprise version.</p>
<p>If you are less handy with javascript you can copy out the XSLT used in the Core Results WebPart in the FAST Search Center site template, modify it some, and use it with a search site based on the “Enterprise Search Center” template instead. This way you will get additional visual improvements to the standard search page without having to install FAST.</p>
<p>The quick way is to replace some of the <em>xsl:params</em> set by the web part with pre-set variables instead. If you have FAST installed, then the parameters will be set via the Core Results Webpart. As we are using the oob search we have to set these parameters as variables instead.</p>
<p><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">OpenPreviewLink</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">&#8216;Preview&#8217;</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">ClosePreviewLink</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">&#8216;Close Preview&#8217;</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">ThumbnailTooltipLoadingFailed</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">&#8216;Loading failed!&#8217;</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">ThumbnailTooltipLoading</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">&#8216;Click to toggle preview&#8217;</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">AAMZone</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">0</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">PreviewWindowSize</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">160</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">EnableDocumentPreviewPowerPoint</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">&#8216;true&#8217;</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">EnableDocumentPreviewWord</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">&#8216;true&#8217;</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">ConcurrentDocumentPreview</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">10</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:variable</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">name</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">TotalDocumentPreview</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;"> </span></span><span><span style="color: #ff0000;">select</span></span><span><span style="color: #0000ff;">=</span></span><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">10</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;"> /&gt;</span></span></span></span></p>
<p>I also had to modify the xslt two more places. Around line 665 and line 725 locate the <em>FST_CheckForPreview</em> call and change the function parameter</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;"> </span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: 'Envy Code R';"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">&#8216;&lt;</span></span></span><span style="font-size: 9.5pt;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #2b91af;">xsl:value-of</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;"> </span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #ff0000;">select</span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="color: #0000ff;">=</span></span></span><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-size: 9.5pt;"><span style="color: #000000;">&#8220;</span><span><span style="color: #0000ff;">sitename</span></span><span style="color: #000000;">&#8220;</span></span><span><span style="font-size: 9.5pt; color: #0000ff;">/&gt;&#8217;</span></span></span></span></p>
<p>with</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-family: 'Envy Code R';"><span style="font-size: 9.5pt; color: #0000ff;"> </span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="mso-bidi-font-family: 'Envy Code R';"><span style="font-family: 'Envy Code R';"><span style="font-size: 9.5pt; color: #0000ff;">&#8216;http://rootsite&#8217;</span></span></span></p>
<p>where rootsite is the name of your SharePoint server url.</p>
<p>This was to ensure the calls to the Mobile API went to the top level site, as they failed when called on sub-site url’s.</p>
<p>That being said, there are several other good reasons for deploying FAST for SharePoint in your organization besides these visual enhancements. Capabilities to enrich and modify your content prior to indexing, thus tailoring search experience towards the real needs of your users, as well as the powerful query capabilities offered via FAST Query Language are just a couple of arguments for choosing FAST.</p>
<p>But then again, it never hurts to have moderate amounts of eye-candy on your search page, as it will increase the perceived quality of the results.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/05/14/document-thumbnails-and-powerpoint-preview-for-your-search-results-without-installing-fast-for-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with crawled and managed properties via code</title>
		<link>http://blog.comperiosearch.com/blog/2011/05/04/working-with-crawled-and-managed-properties-via-code/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/05/04/working-with-crawled-and-managed-properties-via-code/#comments</comments>
		<pubDate>Wed, 04 May 2011 20:52:13 +0000</pubDate>
		<dc:creator><![CDATA[Mikael Svenson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[fs4sp]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/2011/05/working-with-crawled-and-managed-properties-via-code/</guid>
		<description><![CDATA[I was teaching a FAST for SharePoint Workshop today and we were doing labs on creating and mapping crawled properties to managed properties with the FAST Administration UI and via PowerShell. But one student wanted to know how to do this in code, hence this blog post. Instead of having a deployment script creating your [...]]]></description>
				<content:encoded><![CDATA[<p>I was teaching a FAST for SharePoint Workshop today and we were doing labs on creating and mapping crawled properties to managed properties with the FAST Administration UI and via PowerShell. But one student wanted to know how to do this in code, hence this blog post.</p>
<p>Instead of having a deployment script creating your properties, you could have an event receiver which creates your mappings once a site or list is provisioned. Or when some other action is going on.</p>
<p>So how do you go about doing this?</p>
<p>Well, first off Crawled and Managed Properties for FAST are a part of the index schema and is accessible via the following two namespaces:</p>
<p><strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.search.extended.administration.aspx">Microsoft.SharePoint.Search.Extended.Administration</a></strong> <strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.search.extended.administration.schema.aspx">Microsoft.SharePoint.Search.Extended.Administration.Schema</a></strong></p>
<p>which are the namespaces used for working with the FAST components.</p>
<p>Below is a quick example showing how this can be done in code, with comments along the way to guide the process. It’s all pretty straight forward.</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">const</span></span></span><span><span style="font-size: 9.5pt;"><span style="color: #000000;"> </span><span><span style="color: #0000ff;">string</span></span><span style="color: #000000;"> propertyName = </span><span><span style="color: #a31515;">&#8220;productname&#8221;</span></span><span style="color: #000000;">;</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Get a reference to the Index Schema via the SchemaContext class</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">SchemaContext</span></span></span><span><span style="font-size: 9.5pt;"><span style="color: #000000;"> schemaContext = </span><span><span style="color: #0000ff;">new</span></span><span style="color: #000000;"> </span><span><span style="color: #2b91af;">SchemaContext</span></span><span style="color: #000000;">();</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">Schema</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> schema = schemaContext.Schema;</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;"> </span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Assign a guid to the custom Crawled Propery Category</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">Guid</span></span></span><span><span style="font-size: 9.5pt;"><span style="color: #000000;"> myGuid = </span><span><span style="color: #0000ff;">new</span></span><span style="color: #000000;"> </span><span><span style="color: #2b91af;">Guid</span></span><span style="color: #000000;">(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">Category</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> catGroup;</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Create if it does not exist</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> (!schema.AllCategories.Contains(myGuid))</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">{</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">catGroup = schema.AllCategories.Create(</span></span><span style="font-size: 9.5pt;"><span><span style="color: #a31515;">&#8220;My Crawled Properties&#8221;</span></span><span style="color: #000000;">, myGuid);</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">}</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #0000ff;">else</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">{</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">catGroup = schema.AllCategories[myGuid];</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">}</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;"> </span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Create a new crawled property if it doesn&#8217;t exist</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">CrawledProperty</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> cp = catGroup.GetAllCrawledProperties().Where(</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">c =&gt; c.Name == propertyName &amp;&amp; c.VariantType == 31 &amp;&amp; c.Propset == myGuid).FirstOrDefault();</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span><span style="font-size: 9.5pt;"><span style="color: #000000;"> (cp == </span><span><span style="color: #0000ff;">null</span></span><span style="color: #000000;">) cp = catGroup.CreateCrawledProperty(propertyName, myGuid, 31);</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;"> </span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Create a new managed property if it doesn&#8217;t exist</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">ManagedProperty</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> mp;</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> (!schema.AllManagedProperties.Contains(propertyName))</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">{</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">mp = schema.AllManagedProperties.Create(propertyName, </span></span><span style="font-size: 9.5pt;"><span><span style="color: #a31515;">&#8220;&#8221;</span></span><span style="color: #000000;">, </span><span><span style="color: #2b91af;">ManagedType</span></span><span style="color: #000000;">.Text);</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">}</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #0000ff;">else</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">{</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">mp = schema.AllManagedProperties[propertyName];</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">}</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;"> </span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Create a new crawled to managed property mapping if it doesn&#8217;t exit</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">CrawledPropertyMapping</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> mapping = mp.GetCrawledPropertyMappings();</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> (!mapping.Contains(cp))</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">{</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">mapping.Add(cp);</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">mp.SetCrawledPropertyMappings(mapping);</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">}</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;"> </span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Get a reference to the default full text index (first one)</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">FullTextIndex</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> fti = schema.AllFullTextIndecies.First();</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;"> </span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Get the full text index mapping from the Managed Property</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">FullTextIndexMappingCollection</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> fullTextIndexMappingCollection = mp.GetFullTextIndexMappings();</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #2b91af;"><span style="font-size: 9.5pt;">FullTextIndexMapping</span></span></span><span><span style="font-size: 9.5pt; color: #000000;"> indexMapping =</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">fullTextIndexMappingCollection.Where(ftpMap =&gt; ftpMap.FullTextIndex.Name == fti.Name).FirstOrDefault();</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #008000;">// Set a mapping to importance level 6, if it&#8217;s not already set to something else</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span><span style="font-size: 9.5pt;"><span style="color: #000000;"> (indexMapping == </span><span><span style="color: #0000ff;">null</span></span><span style="color: #000000;"> || !fullTextIndexMappingCollection.Contains(indexMapping))</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">{</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;"> </span></span><span style="font-size: 9.5pt;">fullTextIndexMappingCollection.Create(fti, 6);</span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="font-size: 9.5pt; color: #000000;">}</span></span></span></p>
<p class="MsoNormal" style="line-height: 13pt; margin: 0cm 0cm 10pt;"><span style="font-family: Calibri;"><span style="font-size: 11pt; color: #000000;"> </span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/05/04/working-with-crawled-and-managed-properties-via-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Query Suggestions in FAST Search for SharePoint 2010 (FS4SP)</title>
		<link>http://blog.comperiosearch.com/blog/2011/05/03/query-suggestions-fast-search-4-sharepoint-2010-fs4sp/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/05/03/query-suggestions-fast-search-4-sharepoint-2010-fs4sp/#comments</comments>
		<pubDate>Tue, 03 May 2011 09:10:58 +0000</pubDate>
		<dc:creator><![CDATA[Trond Øivind Eriksen]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[fs4sp]]></category>
		<category><![CDATA[query completion]]></category>
		<category><![CDATA[query suggestions]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/?p=409</guid>
		<description><![CDATA[Adding query suggestions to your search solution is a feature that can contribute to a better search experience for end-users. First of all, it makes us save time as we don&#8217;t have to type in the entire query. Secondly, it can help the user avoid potential spelling errors,  which in turn can reduce the quality of the [...]]]></description>
				<content:encoded><![CDATA[<p>Adding query suggestions to your search solution is a feature that can contribute to a better search experience for end-users. First of all, <em>it makes us save time</em> as we don&#8217;t have to type in the entire query. Secondly, it can help the user <em>avoid potential spelling errors</em>,  which in turn can reduce the quality of the results, and avoid that the user has to spend more time finding the information he/she is looking for. Also,  it can aid the user to do the first search more specific, by <em>adding information that may be pertinent to the search</em>.</p>
<p>With FS4SP,  these query suggestions are automatically created over a period of time based on how often the users search for a specific query within a certain timeframe. Sometimes, it can however make sense to modify the query suggestions manually &#8211; and to help us do that, we can always lean on PowerShell.</p>
<p>The script I have implemented, has the following parameters:</p><pre class="crayon-plain-tag">.\QuerySuggestions.ps1 -file [fileName] -action [add|delete] -queryssa [querySSAName]</pre><p>where <em>file</em> is the file with the query suggestion phrases (one per line), <em>action</em> decides if the query suggestions should be added or deleted, <em>queryssa</em> is the name of the Query SSA. And now for the actual code.</p><pre class="crayon-plain-tag">#Get input
param
(
    [string]$file,
    [string]$action,
    [string]$queryssa
)

function LoadQueryCompletion()
{
    # Read input file with stuff that you should add to the Query suggestion list
    if (test-path $file)
    {
        log VERBOSE &quot;Reading file: $file&quot;
	$input = Get-Content $file
    }
    else
    {
        log ERROR &quot;File noe found. Exiting script.&quot;
        exit 1
    }
    # Get SSA search application
    $searchapp = Get-SPEnterpriseSearchServiceApplication -Identity $queryssa

    # Populating a dictionary with the query suggestions that have already been added before
    $query_suggestions = Get-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest
    $already_dict = @{}
    foreach ($term in $query_suggestions)
    {
        if (!$term){ continue }
        $already_dict.Add($term.Phrase,$term.Phrase)
    }

    if ($action -eq &quot;add&quot;)
	{
	    foreach ($entry in $input) {
	        if ($already_dict.ContainsKey($entry))
	        {
	            log WARNING &quot;Key already added: $entry&quot;
	        }
	        else
	        {

			try {
				log VERBOSE &quot;Adding entry ($entry) with language En-US&quot;
			    	$nooutput = new-spenterprisesearchlanguageresourcephrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name $entry
				$already_dict.Add($entry,$entry)
			}catch {
				log ERROR &quot;Could not add entry ($entry). Exiting script.&quot;
				exit 1
			}
	        }
	    }
	}
	elseif ($action -eq &quot;delete&quot;)
	{
		foreach ($entry in $input) {
			try {
				if ($already_dict.ContainsKey($entry)) {
					log VERBOSE &quot;Removing entry ($entry) with language En-US&quot;
			    	        $nooutput = remove-spenterprisesearchlanguageresourcephrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Identity $entry -Confirm:$false
					$already_dict.Remove($entry)
				}else{
					log WARNING &quot;Entry ($entry) has not been added as a query suggestion&quot;
				}
			}catch {
				log ERROR &quot;Could not remove entry ($entry).&quot;
			}
	    }
	}
	else
	{
		log ERROR &quot;-action parameter contains an invalid value. Exiting script.&quot;
	}

    #Run timerjob manually to upload entries from DB
    Start-SPTimerJob -Identity &quot;prepare query suggestions&quot;

    log VERBOSE &quot;Finished loading query completion phrases.&quot;
}

#Main
$spInstalled = Get-PSSnapin | Select-String Sharepoint
if (!$spInstalled)
{
    Add-PSSnapin Microsoft.Sharepoint.PowerShell
}
LoadQueryCompletion</pre><p>If you want to include the logging output , add this to the top of the PowerShell script.</p><pre class="crayon-plain-tag"># Log level to color mapping
$lc = @{
	VERBOSE=&quot;green&quot;;
	WARNING=&quot;yellow&quot;;
	ERROR=&quot;red&quot;;
	MESSAGE=&quot;blue&quot;;
}
function log([string] $level, [string] $message) {
	$date = get-date -uformat &quot;%G-%m-%d %T&quot;
	write-host &quot;[$date] &quot; -nonewline
	write-host -foregroundcolor $lc[$level] $level.padright(7) -nonewline
	write-host &quot; $message&quot;
}</pre><p>If you&#8217;re really picky (like me), you should also consider having some kind of validation on the input parameters. For instance verifying that the file exists, that the action parameter contains a valid value, and that the Query SSA exists. You can check the last-mentioned by adding the following lines of code to the script.</p><pre class="crayon-plain-tag">$ssaExists = Get-SPEnterpriseSearchServiceApplication | Select-String $queryssa
if ($ssaExists -eq $null)
{
	log ERROR &quot;-queryssa is invalid. Search Service Application does not exist. Exiting script.&quot;
	$queryssas = Get-SPEnterpriseSearchServiceApplication | Where-Object {$_.DefaultSearchProvider -eq &quot;FASTSearch&quot;}
	foreach ($queryssa in $queryssas)
        {
		if ($queryssa)
    	    	{
    			$name = $queryssa.Name
    			log VERBOSE &quot;Found the following Query SSA: $name&quot;
    	    	}
        }
}</pre><p>After doing that, you should be ready to run the script on the SharePoint Admin server.</p>
<p>Afterwards, go to your FAST Search Center, and start typing one of the terms you have added. The result can look something like in the screenshot below.</p>
<p><img class="alignnone size-full wp-image-410" src="http://blog.comperiosearch.com/wp-content/uploads/2011/05/QuerySuggestions.png" alt="" width="428" height="246" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/05/03/query-suggestions-fast-search-4-sharepoint-2010-fs4sp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding new nicknames to SharePoint People Search</title>
		<link>http://blog.comperiosearch.com/blog/2011/04/28/adding-new-nicknames-to-sharepoint-people-search/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/04/28/adding-new-nicknames-to-sharepoint-people-search/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 13:49:06 +0000</pubDate>
		<dc:creator><![CDATA[Mikael Svenson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/2011/04/adding-new-nicknames-to-sharepoint-people-search/</guid>
		<description><![CDATA[Out of the box SharePoint 2010 comes with a pretty good people search. This is due to a combination of phonetic rules and a vast list of nicknames. Out of the box the US English nickname list consists of over 14.000 nickname mappings, ensuring good results when trying to find people. But what if you [...]]]></description>
				<content:encoded><![CDATA[<p>Out of the box SharePoint 2010 comes with a pretty good people search. This is due to a combination of phonetic rules and a vast list of nicknames. Out of the box the US English nickname list consists of over 14.000 nickname mappings, ensuring good results when trying to find people.</p>
<p>But what if you are located in a different part of the world, speaking some obscure language like Norwegian, which is my native tongue, and where names are sounding nothing like English ones? What then?<span id="more-406"></span>Phonetics and nicknames are handled by the Microsoft Speech Platform. Default only en-us is installed, but you can download and install the runtime for your particular language. Your mileage seems to vary with how good the other language runtimes actually are, and my tests show that the English one usually gives the best results.</p>
<p>Still, you might have to add some nick names of your own. Here’s how:</p>
<p>SharePoint PowerShell has a command called <a href="http://technet.microsoft.com/en-us/library/ff608062.aspx">New-SPEnterpriseSearchLanguageResourcePhrase</a>. This command can take a Type parameter of <strong>Nickname</strong> (which for some reason is not listed on the TechNet page, but is documented on the <strong>Get</strong> version of the same command).</p>
<p>If I wanted to add the nickname <strong>slick</strong> for my own name, and vice versa I would execute the following PowerShell Commands:</p>
<p><span style="font-family: 'Courier New';">$ssa = Get-SPEnterpriseSearchServiceApplication FASTQuery </span></p>
<p><span style="font-family: 'Courier New';"> </span></p>
<p><span style="font-family: 'Courier New';"> </span><span style="font-family: 'Courier New';">New-SPEnterpriseSearchLanguageResourcePhrase –Name mikael -Language &#8220;en-US&#8221; –Type &#8220;Nickname&#8221; –Mapping slick -SearchApplication $ssa </span></p>
<p><span style="font-family: 'Courier New';"> </span></p>
<p><span style="font-family: 'Courier New';">New-SPEnterpriseSearchLanguageResourcePhrase –Name slick -Language &#8220;en-US&#8221; –Type &#8220;Nickname&#8221; –Mapping mikael -SearchApplication $ssa </span></p>
<p><span style="font-family: 'Courier New';"><span style="font-family: Georgia;"><strong>FASTQuery</strong> is the name of my Query SSA. Also note the <strong>Language</strong> parameter. Your query language has to match this in order for the nicknames to be used, and my suggestion is to set this to for the language you choose to use for phonetics and nicknames.</span></span></p>
<p><span style="font-family: 'Courier New';"><span style="font-family: Georgia;">Then in order to re-generate the language files run the command:</span></span></p>
<p><span style="font-family: 'Courier New';">Start-SPTimerJob -Identity &#8220;Prepare query suggestions&#8221;</span></p>
<p><span style="font-family: 'Courier New';"><span style="font-family: Georgia;">And your nicknames should be up and running from the search page.</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/04/28/adding-new-nicknames-to-sharepoint-people-search/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Prototyping pipeline stages in PowerShell</title>
		<link>http://blog.comperiosearch.com/blog/2011/03/02/prototyping-pipeline-stages-in-powershell/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/03/02/prototyping-pipeline-stages-in-powershell/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 10:56:10 +0000</pubDate>
		<dc:creator><![CDATA[Mikael Svenson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fs4sp]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/2011/03/prototyping-pipeline-stages-in-powershell/</guid>
		<description><![CDATA[The defacto way of creating a custom pipeline stage in FAST for SharePoint is to create an executable file which reads and writes an xml file. This usually implies having Visual Studio available and compiling and deploying a new file each time you make a change in order to test it in a proper pipeline. [...]]]></description>
				<content:encoded><![CDATA[<p>The defacto way of creating a custom pipeline stage in FAST for SharePoint is to create an executable file which reads and writes an xml file. This usually implies having Visual Studio available and compiling and deploying a new file each time you make a change in order to test it in a proper pipeline.</p>
<p>To the rescue comes PowerShell. Since all FAST servers have PowerShell installed you can create a PowerShell script and use this. All you need is notepad :) This gives the flexibility of trying out stuff without recompiling. But the cost is speed of execution. So you might want to port the code over to e.g. C# when you are done testing your code.</p>
<blockquote><p>See my post “<a href="http://techmikael.blogspot.com/2010/12/how-to-debug-and-log-fast-search.html" target="_blank">How To: Debug and log FAST Search pipeline extensibility stages in Visual Studio</a>” on how to do this in C#, and also how to create your own property set with PowerShell commands.</p></blockquote>
<p>In order to register the script in pipelineextensibility.xml we prepend the ps1 file with the PowerShell runtime</p>
<div id="codeSnippetWrapper">
<pre class="crayon-plain-tag">&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;Run&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;command&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe C:\FASTSearch\pipelinemodules\concept.ps1 %(input)s %(output)s&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;   &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;Input&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;           &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;CrawledProperty&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;propertySet&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;48385C54-CDFC-4E84-8117-C95B3CF8911C&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;varType&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;31&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;propertyName&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;docvector&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;   &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;Input&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;   &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;Output&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;     &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;CrawledProperty&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;propertySet&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;fa585f53-2679-48d9-976d-9ce62e7e19b7&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;varType&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;31&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;propertyName&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;concepts&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;/&amp;gt;&lt;/span&gt;   &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;Output&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;Run&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;</pre>
</div>
<p>In PowerShell you have the option to instantiate any .Net object, and for this script I use the XmlDocument class for xml creation out the result file. The script is pretty straight forward as it reads in an xml file. Selects a property called “docvector” and writes this out to a new field called “concepts”.  Typically you would do more work than just copy an attribute, but it shows the concept.</p>
<p>I’m not a PowerShell expert, so there might be better ways of doing some parts of this script. Make a note that I read and write the xml files with UTF-8 encoding. This is crucial as this is what the pipeline works with.</p>
<p><strong>concept.ps1</strong></p>
<p><strong> </strong></p><pre class="crayon-plain-tag">function CreateXml()
{
	param ([string]$set, [string]$name, [int]$type, $value)

	$resultXml = New-Object xml
	$doc = $resultXml.CreateElement(&quot;Document&quot;)

	$crawledProperty = $resultXml.CreateElement(&quot;CrawledProperty&quot;)
	$propSet = $resultXml.CreateAttribute(&quot;propertySet&quot;)
	$propSet.innerText = $set
	$propName = $resultXml.CreateAttribute(&quot;propertyName&quot;)
	$propName.innerText = $name
	$varType = $resultXml.CreateAttribute(&quot;varType&quot;)
	$varType.innerText = $type

	$crawledProperty.Attributes.Append($propSet) &amp;gt; $null
	$crawledProperty.Attributes.Append($propName) &amp;gt; $null
	$crawledProperty.Attributes.Append($varType) &amp;gt; $null

	$crawledProperty.innerText = $value

	$doc.AppendChild($crawledProperty) &amp;gt; $null
	$resultXml.AppendChild($doc) &amp;gt; $null
	$xmlDecl = $resultXml.CreateXmlDeclaration(&quot;1.0&quot;, &quot;UTF-8&quot;, &quot;&quot;)
	$el = $resultXml.psbase.DocumentElement
	$resultXml.InsertBefore($xmlDecl, $el) &amp;gt; $null

	return $resultXml
}

function DoWork()
{
	param ([string]$inputFile, [string]$outputFile)
	$propertyGroupIn = &quot;48385c54-cdfc-4e84-8117-c95b3cf8911c&quot; # FAST internal group
	$propertyNameIn = &quot;docvector&quot; # property name
	$dataTypeIn = 31 # integer

	$propertyGroupOut = &quot;fa585f53-2679-48d9-976d-9ce62e7e19b7&quot; # Custom group
	$propertyNameOut = &quot;concepts&quot; # property name
	$dataTypeOut = 31 # integer

	$xmldata = [xml][/xml][/xml]

(Get-Content $inputFile -Encoding UTF8) 	$node = $xmldata.Document.CrawledProperty | Where-Object {  $_.propertySet -eq $propertyGroupIn -and  $_.propertyName -eq $propertyNameIn -and $_.varType -eq $dataTypeIn } 	$data = $node.innerText  	# do your custom modification on $data here  	$resultXml = CreateXml $propertyGroupOut $propertyNameOut $dataTypeOut $data 	$resultXml.OuterXml | Out-File $outputFile -Encoding UTF8 } DoWork $args[0] $args[1]</pre><p>[Originally postet at <a href="http://techmikael.blogspot.com/2011/03/prototyping-pipeline-stages-in.html">http://techmikael.blogspot.com/2011/03/prototyping-pipeline-stages-in.html</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/03/02/prototyping-pipeline-stages-in-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the SharePoint Search &#8220;Best Bet&#8221; feature to redirect to a landing page</title>
		<link>http://blog.comperiosearch.com/blog/2011/02/19/using-the-sharepoint-search-best-bet-feature-to-redirect-to-a-landing-page/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/02/19/using-the-sharepoint-search-best-bet-feature-to-redirect-to-a-landing-page/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 11:14:00 +0000</pubDate>
		<dc:creator><![CDATA[Mikael Svenson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fs4sp]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/2011/03/using-the-sharepoint-search-best-bet-feature-to-redirect-to-a-landing-page/</guid>
		<description><![CDATA[[Cross-posted from Tech And Me] As described on TechNet: Best Bets are recommended results. Best Bets can link to recommended Web sites, data stores, and documents. When a user includes a keyword or one of its synonyms in a query, the search results page features links to its associated Best Bets in a prominent position. [...]]]></description>
				<content:encoded><![CDATA[<p>[Cross-posted from <a href="http://techmikael.blogspot.com/2011/01/using-sharepoint-search-best-bet.html" target="_blank">Tech And Me</a>]</p>
<p>As described on TechNet:</p>
<blockquote><p><strong>Best Bets</strong> are recommended results. Best Bets can link to recommended Web sites, data stores, and documents. When a user includes a keyword or one of its synonyms in a query, the search results page features links to its associated Best Bets in a prominent position.</p></blockquote>
<p>This can look something like this for the search term “search” on my sample site:</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image5.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb5.png" border="0" alt="image" width="504" height="251" /></a></p>
<p><span id="more-219"></span>In order to turn this into a landing page redirect we will change the uri scheme and edit the Best Bet web part xslt. By using this method you might see a quick flicker of the page before the redirect, but compared to the work involved it might be a small price to pay.</p>
<p>First we need to add a new Best Bet term. We do this by navigating to the site collection settings page where your search center site is hosted and choose “FAST Search keywords”. This should also work if you are not using FAST, but you have to choose “Search keywords” instead.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image6.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb6.png" border="0" alt="image" width="344" height="124" /></a></p>
<p>Next click “Add Keywords”</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image7.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb7.png" border="0" alt="image" width="385" height="148" /></a></p>
<p>Enter your search term, in this example “search” and click OK.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image8.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb8.png" border="0" alt="image" width="504" height="306" /></a></p>
<p>Hover your mouse over your search term, click the down arrow and select the “Add Best Bet” link. (Adding a Best Bet for regular search looks a bit different, but the procedure is more or less the same)</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image9.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb9.png" border="0" alt="image" width="351" height="311" /></a></p>
<p>Enter a title and note that I instead of “http”, enters “redirect” in front of the url</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image10.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb10.png" border="0" alt="image" width="504" height="333" /></a></p>
<p>Navigate to the search result page and enter edit mode. Next edit the Best Bet web part.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image11.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb11.png" border="0" alt="image" width="504" height="263" /></a></p>
<p>Under “Data View Properties” open the XSL Editor. If you copy out the xsl you will around line 67 add the following code:</p><pre class="crayon-plain-tag">&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;xsl:if&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;substring($url,1,9) = 'redirect:' and $IsDesignMode = 'False'&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
         window.location = &lt;span class=&quot;str&quot;&gt;&quot;http:&amp;lt;xsl:value-of disable-output-escaping=&quot;&lt;/span&gt;yes&lt;span class=&quot;str&quot;&gt;&quot; select=&quot;&lt;/span&gt;srwrt:HtmlAttributeEncode(substring($url,10))&lt;span class=&quot;str&quot;&gt;&quot; /&amp;gt;&quot;&lt;/span&gt;;
    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;xsl:if&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;</pre><p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image12.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb12.png" border="0" alt="image" width="504" height="177" /></a></p>
<p>The added xsl will check for url’s starting with “redirect”, and use javascript to redirect to the actual url.</p>
<p>After saving the changes to the web part and the page, try to search for your defined best bet term, and you should be redirected.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/02/19/using-the-sharepoint-search-best-bet-feature-to-redirect-to-a-landing-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to: Frame a search center with little work</title>
		<link>http://blog.comperiosearch.com/blog/2011/01/27/how-to-frame-a-search-center-with-little-work/</link>
		<comments>http://blog.comperiosearch.com/blog/2011/01/27/how-to-frame-a-search-center-with-little-work/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 13:05:00 +0000</pubDate>
		<dc:creator><![CDATA[Mikael Svenson]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[sp2010]]></category>

		<guid isPermaLink="false">http://nuggets.comperiosearch.com/2011/01/how-to-frame-a-search-center-with-little-work/</guid>
		<description><![CDATA[Lately I have encountered several customs who deploy search from SharePoint 2010, but they still have other solutions running on MOSS 2007 or other portal frameworks. Instead of creating custom solutions using the search service on SharePoint 2010, framing is a quick solution to get you up and running. One way is to create a [...]]]></description>
				<content:encoded><![CDATA[<p>Lately I have encountered several customs who deploy search from SharePoint 2010, but they still have other solutions running on MOSS 2007 or other portal frameworks. Instead of creating custom solutions using the search service on SharePoint 2010, framing is a quick solution to get you up and running.</p>
<p>One way is to create a custom master page to replace v4.master for the search center, but this requires html knowledge and tinkering. In many cases it’s just as easy to go the configuration way.</p>
<h4>Hello IsDlg=1and s4-notdlg</h4>
<p>You have probably seen throughout SharePoint 2010 that it opens modal dialogs for different tasks. For example if you want to create a new site you get a dialog looking something like this</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image2.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb2.png" border="0" alt="image" width="644" height="348" /></a></p>
<p>The source for this page is loaded from /_layouts/AddGallery.aspx?<strong>IsDlg=1</strong></p>
<p>The part to note is the appending of IsDlg=1 which tells the page it is rendered in a modal dialog. In effect this will change some styles for the page which hides the ribbon and top menus based on the style sheet class s4-notdlg. (MSDN: <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.unsecuredlayoutspagebase.isdialogmode.aspx">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.unsecuredlayoutspagebase.isdialogmode.aspx</a>).</p>
<p>In order for a page to frame in search they will merely append IsDlg=1 to the search center url.</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image3.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb3.png" border="0" alt="image" width="562" height="484" /></a></p>
<p>Unfortunately the IsDlg=1 parameter is not added automatically to all links. There are a couple of places we need to edit.</p>
<p>First off is the  Advanced link. Edit the search page and append IsDlg=1&amp; to the link</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image4.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://blog.comperiosearch.com/wp-content/uploads/2011/01/image_thumb4.png" border="0" alt="image" width="119" height="244" /></a></p>
<p>After saving switch over to the People search box and do the same edit for the people search result page.</p>
<p>In theory we could add ?IsDlg=1 to the result page link as well, but this won’t work as ?k=searchterm is added in front of it, and two question marks in the url messes up the parsing.</p>
<p>Instead we modify the xslt for the result pages by a small style sheet entry.</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<pre class="crayon-plain-tag">&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;xsl:text&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;disable-output-escaping&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;yes&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;     &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;!&lt;/span&gt;[CDATA[    &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;style&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;=&quot;text/css&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;    .s4-notdlg { display: none !important }    &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;    ]]&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;xsl:text&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;gt;&lt;/span&gt;</pre>
</div>
<p>This can be places below &lt;xsl:template match=&#8221;/&#8221;&gt;  at the end of the default xslt. Do the same for the xslt on the people search result page.</p>
<p>The caveat with setting the s4-notdlg style is that it will hide the ribbon menus regardless of the IsDlg query parameter. This leads us to have one search center for framing and one which is used natively in SharePoint 2010.</p>
<p>So the question remains, is it better to rely on IsDlg and s4-notdlg or should I go for a custom master page?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2011/01/27/how-to-frame-a-search-center-with-little-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
