Making Synonyms Visible in SharePoint 2013 Search Results

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. 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 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 .

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. (See Microsoft for further details )

The thesaurus is simple, but it works. Or, does it really? Testing synonyms fetched from the internet on a SharePoint search index populated with US Court records crawled from theinfo.org.  AKA is a common legal term synonymous with “also known as”. So let’s try that out.

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.
So I create a thesaurus containing:

And upload it with the powershell command:

I wait for a few seconds, and search for “aka”.
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:

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).

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.

We begin by connecting to the Interactionengine:

Now, let’s try to rip out the configurations of the SharePointSearchProvider flow:

Reading the flow configurations for the SharePointSearchProviderFlow, we find an option named synonymWeight.

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.
So, we set the synonymWeight to 1, and upload the file.

Now, when searching for “aka”, we get hits containing “also know as” on the first search results page.
Voila!

Article written by

Christoffer Vig
Senior Consultant at Comperio. Christoffer started putting small blocks together to form interesting shapes already as a very young boy. He never stopped.

6 response to: «Making Synonyms Visible in SharePoint 2013 Search Results»

  1. [...] Making Synonyms Visible in SharePoint 2013 Search Results Share this:TwitterFacebookLinkedInWordPress:J’aime chargement… Catégories:SharePoint 2013 Tags:search, SharePoint 2013, Synonym, thésaurus Commentaires (0) Rétroliens (0) Poster un commentaire Rétrolien [...]

  2. June 12, 2013 at 21:04 | Permalink

    Hi, great article.
    I’m trying to get the synonym into a separate keyword or manager property. How can i get that?

  3. October 1, 2013 at 23:57 | Permalink

    Christoffer,

    Excellent post and exactly what is needed to treat synonyms equally.

    Have you also modified the stemWeight property?
    It is the same .2 aka 20% by default. In my testing, stemmed words appeared to behave the same way, plurals were not ranked the equivalent of the root word.

    I tested modifying stemWeight up to “1″ using the same method. Voila, it appears to behave exactly as expected. I am curious if you’ve done similar tests.

    On a separate note, I’ve run your powershell in several SP2013 environments without problems. However at one customer (all 3 ENVs) the powershell keeps failing on the Connect-System. Have you run into this?
    thanks.

    > Connect-System -Uri (Get-PEnterpriseSearchServiceApplication).SystemManagerLocations[0] -ServiceIdentity (Get-SPEnterpriseSearchService).ProcessIdentity

    Connect-System : Could not connect to system: initial URI: net.tcp://servername/3E9C46/AdminComponent1/Management, tried:
    net.tcp://servername/3E9C46/AdminComponent1/Management
    At line:1 char:1
    + Connect-System -Uri (Get-SPEnterpriseSearchServiceApplication).SystemManagerLoc …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Connect-System], ControllerException
    + FullyQualifiedErrorId : Microsoft.Ceres.CoreServices.Tools.Management.SystemController.ControllerException,Microsoft.Cer
    es.CoreServices.Tools.Management.Cmdlets.ConnectSystem

  4. February 13, 2014 at 11:42 | Permalink

    We have imported a thesaurus for a customer employee search site in SharePoint 2013. The synonyms work fine in standard search, but when using the people search scope.. the synonyms does not apply. Any explanations for this anyone? :)

  5. April 7, 2014 at 16:25 | Permalink

    Hi Terje A T,
    I asked around here, but we didn’t have any good answer on your question, sorry.

  6. March 9, 2015 at 12:01 | Permalink

    even i am facing the issue while running the powershell command what richard is facing i am getting an error

    “> Connect-System -Uri (Get-PEnterpriseSearchServiceApplication).SystemManagerLocations[0] -ServiceIdentity (Get-SPEnterpriseSearchService).ProcessIdentity

    Connect-System : Could not connect to system: initial URI: ”

    Have anyone got this?



Leave a response





XHTML: These tags are allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">


OSLO

Comperio AS
Øvre Slottsgate 27
NO-0157 Oslo,
Norway
+47 22 33 71 00
View map

STOCKHOLM

Search Provider Sverige AB
Gamla Brogatan 34
SE-11 120 Stockholm
Sweden
+46 8-21 49 00
View map