Import a synonym thesaurus to improve search in SharePoint server

Health care or healthcare? Doctor or physician? Emergency room or ER?

No matter which terms, spellings or abbreviations a SharePoint search user uses, they’re searching for something specific. By utilizing a simple thesaurus, we can make sure that a user searching for “ER” also gets results that include “emergency room.”

How to create a thesaurus

Note: Not currently available in SharePoint online/O365. But should be supported in 2013/2016/2019. 

What to include

If your industry is like most others, you have many acronyms – that’s a good starting place for building a thesaurus. Your thesaurus can contain considerations such as:

  • Acronyms (ER/ED for emergency room/department)
  • Abbreviations (Dr. and doctor)
  • Common misspellings (absess and abscess)
  • Formal and casual pairs (gastric and stomach)
  • Synonyms (purchasing, requisition, ordering, supplies, etc.)
  • Variations of a word (radiology, radiologist, radiologic, radiological)

Once you’ve compiled your basic thesaurus from going through the above suggestions, you should analyze the search reports provided by SharePoint to see what people have been actually searching but not finding. Then use those search terms to further enhance your thesaurus.

For example, when my governance committee analyzed search reports, we came up with people searching for “KU” (our local University and neighboring health system) and added “University of Kansas” to our thesaurus.

Import your completed thesaurus

Note: Each time you import, it overwrites the existing thesaurus. I recommend updating the same file you’ve created with new lines rather than recreating it multiple times. Also be sure to save the file in a place others can access and update in your absence. You won’t be able to export it later.

Repeat these steps each time you want to update the thesaurus:

Note: You must be a search service application administrator to import the thesaurus.

Log in to a SharePoint server and run PowerShell with the SharePoint snap-in or just use the SharePoint management shell (recommended). Either way, run as administrator.

Run the following cmdlets

$searchApp = Get-SPEnterpriseSearchServiceApplication 
Import-SPEnterpriseSearchThesaurus -SearchApplication $searchApp -Filename <Full UNC Path>

If successful, you’ll see the following confirmation:

Test your work!

The changes should be almost instant, with no need to perform any crawls. Here’s an example of how in our search “med staff” now also searches for “medical staff”.

2 Replies to “Import a synonym thesaurus to improve search in SharePoint server”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.