<?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; flows</title>
	<atom:link href="http://blog.comperiosearch.com/blog/tag/flows/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>Making Synonyms Visible in SharePoint 2013 Search Results</title>
		<link>http://blog.comperiosearch.com/blog/2013/05/25/sharepoint-search-2013-how-to-make-words-from-the-thesaurus-a-k-a-synonyms-visible-in-the-search-results/</link>
		<comments>http://blog.comperiosearch.com/blog/2013/05/25/sharepoint-search-2013-how-to-make-words-from-the-thesaurus-a-k-a-synonyms-visible-in-the-search-results/#comments</comments>
		<pubDate>Sat, 25 May 2013 15:18:15 +0000</pubDate>
		<dc:creator><![CDATA[Christoffer Vig]]></dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Ceres]]></category>
		<category><![CDATA[flows]]></category>
		<category><![CDATA[fsis]]></category>
		<category><![CDATA[linguistics]]></category>
		<category><![CDATA[SharePoint 2013]]></category>
		<category><![CDATA[SharePoint 2013 Search]]></category>
		<category><![CDATA[synonyms]]></category>
		<category><![CDATA[Thesaurus]]></category>

		<guid isPermaLink="false">http://blog.comperiosearch.com/?p=1431</guid>
		<description><![CDATA[SharePoint 2013 Search has built-in support for thesaurus enrichment of queries. However, synonyms are often not visible in the search results. This post will show you how you can modify the synonym weight using the Ceres shell. The internal workings of SharePoint 2013 Search can be controlled using the Ceres shell, a set of powershell cmdlets. [...]]]></description>
				<content:encoded><![CDATA[<p>SharePoint 2013 Search has built-in support for thesaurus enrichment of queries.<br />
However, synonyms are often not visible in the search results.<br />
This post will show you how you can modify the synonym weight using the Ceres shell.</p>
<p><span id="more-1431"></span></p>
<address><strong>The internal workings of <strong>SharePoint 2013 Search</strong> can be controlled using the Ceres shell, a set of powershell cmdlets. Using the shell we can  inspect and  modify a whole lot of stuff that probably never was meant to be touched by end users.  Modifying the flow configurations can <strong>potentially ruin your SharePoint installation. Comperio Search will take no responsibility for any damage caused by actions taken based on what you read in this blog .</strong></strong></address>
<p>The thesaurus lookup is performed at query time, and the dictionary can be set up with support for various languages. The thesaurus must be deployed as a csv file using powershell, it has columns for key, synonym, and an optional language. The “key” column can be a phrase, and so can the synonym. ie. “Go fishing” can be a synonym for “hunt for fish”. To provide several synonyms for a word, simply add it several times. To make the synonym go both ways, add a second entry with the word and synonym switching place. (<a title="Create and deploy a thesaurus in SharePoint Server 2013" href="http://technet.microsoft.com/en-us/library/jj219579.aspx">See Microsoft for further details</a> )</p>
<p>The thesaurus is simple, but it works. Or, does it really? Testing synonyms fetched from <a title="State of Connecticut, Judicial Branch" href="http://www.jud.ct.gov/legalterms.htm">the internet</a> on a SharePoint search index populated with US Court records crawled from <a title="theinfo.org" href="http://theinfo.org">theinfo.org</a>.  AKA is a common legal term synonymous with “also known as”. So let’s try that out.</p>
<p>Searching for “aka” yields some hundred results, searching for “also known as” yields a different set of results of roughly the same size. By adding synonyms we would expect the search results to combine the hits for both queries into one, so to speak.<br />
So I create a thesaurus containing:</p><pre class="crayon-plain-tag">Key,Synonym,Language
aka,also known as</pre><p>And upload it with the powershell command:</p><pre class="crayon-plain-tag">$searchApp = Get-SPEnterpriseSearchServiceApplication
Import-SPEnterpriseSearchThesaurus -SearchApplication $searchApp -Filename \\spbox\temp\thesaurus.csv</pre><p>I wait for a few seconds, and search for “aka”.<br />
Now, I would expect to find hits containing “also known as”. But where is it? I have to scroll and page down to the bottom of page 3 before I find it:</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2013/05/synonymweighaka0.22.png"><img class="alignnone size-full wp-image-1451" src="http://blog.comperiosearch.com/wp-content/uploads/2013/05/synonymweighaka0.22.png" alt="" width="559" height="418" /></a></p>
<p>Why? Could the ULS logs provide any clues? Turning on verbose logging on the Search Query Processing, and search again. Now, in the ULS logs there are entries with “After thesaurus tree modification” (the indentation is mine, trying to make it look a little clearer, also abbreviated it some).</p><pre class="crayon-plain-tag">Microsoft.Office.Server.Search.Query.Pipeline.Executors.LinguisticQueryProcessingExecutor : After thesaurus tree modification:
	'AndNode(FirstChild=StringNode
(FirstChild=WordsNode(FirstChild=TokenNode(FirstChild=null,NextSibling=OnearNode(FirstChild=TokenNode(FirstChild=null,NextSibling=TokenNode
		(FirstChild=null,NextSibling=TokenNode
			(FirstChild=null,NextSibling=null,Length=1,Linguistics=True,Token=&lt;strong&gt;as&lt;/strong&gt;,Weight=1),
			Length=1,Linguistics=True,Token=&lt;strong&gt;known&lt;/strong&gt;,Weight=1),
			Length=1,Linguistics=True,Token=&lt;strong&gt;also&lt;/strong&gt;,Weight=1),NextSibling=null
,ExtraTermsAllowed=0,&lt;strong&gt;Weight=0.2&lt;/strong&gt;),
Length=1,Linguistics=True,Token=&lt;strong&gt;aka&lt;/strong&gt;,Weight=1),NextSibling=null),</pre><p>The synonyms are given a weight of 0.2. The original term has a weight of 1, theoretically that means the synonym has 20% percent weight of the original term. Perhaps we could make the synonyms show up by increasing the weight.  So, how can we do that? Apparently, there is no way.  Not unless we open up the magic box of the Ceres shell.</p>
<p>We begin by connecting to the Interactionengine:</p><pre class="crayon-plain-tag">Add-PsSnapin Microsoft.SharePoint.Powershell
&amp;amp; &quot;C:\Program Files\Microsoft Office Servers\15.0\Search\Scripts\ceresshell.ps1&quot;
Connect-System -Uri  (Get-SPEnterpriseSearchServiceApplication).SystemManagerLocations[0] -ServiceIdentity (Get-SPEnterpriseSearchService).ProcessIdentity
Connect-Engine -NodeTypes InterActionEngine</pre><p>Now, let’s try to rip out the configurations of the SharePointSearchProvider flow:</p><pre class="crayon-plain-tag">$flowname = Microsoft.SharePointSearchProviderFlow
Get-Flow $flowname  &amp;gt; $flowname.txt</pre><p>Reading the flow configurations for the SharePointSearchProviderFlow, we find an option named synonymWeight.</p><pre class="crayon-plain-tag">&amp;lt;Operator name=&quot;Linguistics&quot; type=&quot;LinguisticQueryProcessing&quot;&amp;gt;
  lt;Property name=&quot;querySpellingCorrectionTokenLimit&quot; value=&quot;10&quot; /&amp;gt;
...
&amp;lt;Property name=&quot;stemWeight&quot; value=&quot;0.2&quot; /&amp;gt;

&amp;lt;Property name=&lt;strong&gt;&quot;synonymWeight&quot; value=&quot;0.2&quot; &lt;/strong&gt;/&amp;gt;

&amp;lt;/Properties&amp;gt;

&amp;lt;/Operator&amp;gt;</pre><p>Strangely, it has the weight 0.2. Ring any bells, anyone? It is the same weight we saw in the ULS. Now, let us try to see what happens if we increase the weight here.<br />
So, we set the synonymWeight to 1, and upload the file.</p><pre class="crayon-plain-tag">Remove-Flow $flowname
Get-Content $flowname.txt | Out-String | Add-Flow $flowname
Stop-Flow &ndash;FlowName $flowname &ndash;ForceAll</pre><p>Now, when searching for “aka”, we get hits containing “also know as” on the first search results page.<br />
Voila!</p>
<p><a href="http://blog.comperiosearch.com/wp-content/uploads/2013/05/synonymweigh11.png"><img class="alignnone size-full wp-image-1452" src="http://blog.comperiosearch.com/wp-content/uploads/2013/05/synonymweigh11.png" alt="" width="566" height="424" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.comperiosearch.com/blog/2013/05/25/sharepoint-search-2013-how-to-make-words-from-the-thesaurus-a-k-a-synonyms-visible-in-the-search-results/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
