Synonyms not working in SharePoint Search

The custom thesaurus functionality of SharePoint search should be old hat to those of us experienced with MS Full Text Search, which is a mature technology that’s been around for years. What may trip you up in trying to get custom synonyms working with SharePoint’s implementation is the nuances of the file paths and deployment across multiple physical servers in a farm.

A basic example of the thesaurus format is as follows. This one would match instances of “it” to “information technology”

<XML ID="Microsoft Search Thesaurus">
    <thesaurus xmlns="x-schema:tsSchema.xml">
 <diacritics_sensitive>1</diacritics_sensitive>
        <expansion>
            <sub>it</sub>
            <sub>information technology</sub>
        </expansion>
    </thesaurus>
</XML>

First, does your thesaurus file validate as proper XML? Sometimes a forgotten –> closing tag etc. can be a showstopper.

Thesaurus files are stored in several locations on a SharePoint Server:

  Program Files  Microsoft Office Servers  14.0  Data  Config  

Updates to the thesaurus files here will ensure that any new Search Service Applications that you create will have the updated thesaurus definitions when they spin up.

  Program Files  Microsoft Office Servers  14.0  Data  Applications  Config  

GUID is the guid of your Search Service Application, which you can get by using Get-SPServiceApplication. That powershell command will list your service applications and their corresponding GUID’s.

When you’ve verified your updated tsneu.xml files are in those locations, you’ll need to restart the search service with these commands:

net stop osearch
net start osearch

Once the service is restarted, go to your search center and plug in one of the newly added expansion/replacement terms to see your results.

If you’re running search on multiple servers, you will need to perform these steps on each server running search. If there are multiple search applications running, you have to copy your thesaurus files to each config directory under the GUID folder for each search service application.

You can run into the following situation when trying to get a custom thesaurus to kick in for the SharePoint search service:

1. You set up the thesaurus file(s), in our example we’ll use the basic tsneu.xml, which is the language-neutral default thesauraus.
2. You try putting the thesaurus XML file into

%ProgramFiles%  Microsoft Office Servers  14.0  Data  Applications  Config 

and in

%ProgramFiles%  Microsoft Office Servers  14.0  Data  office servers  applications  data  

but with no luck – you don’t see the search results.
3. You try creating a folder on each query/crawl server with the GUID of the search application.
4. Restart the services.

Still no synonyms? It may be that you have partitioned the index, in which case the path changes, and it´s not the default one but the one you set up into the Central Administration > Manage search topology.

Chang the files there, restart the search service and voila!

Search Service Application, SharePoint, Thesaurus, XML

Leave a Reply

Your email address will not be published. Required fields are marked *