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.
- Create/open a new text file using Notepad
- One the top line of the file type “Key,Synonym,Language”
- On each following line, insert the initial search term (key) followed by the synonym SharePoint should also search for when the “key” is used. End each with an ISO 639-1 language code for your region (optional). Separate each component with a comma (no spaces) as seen below.
- In the previous example, you’ll notice we have to do each twice by switching the order so that whether a user searches “Information Technology” or “IT” they get results including both.
- If you’re including commonly misspelled words, you may wish not to provide the inverse/second option – just use the misspelling as the key with the correct word as the synonym. But if you’re afraid your content and results may also have the misspelling, I would include both (or fix the misspellings in your content).
- The thesaurus is not case-sensitive
- Don’t include quotations around multi-word phrases. The commas are all you need.
- Save it to a server/network location such as \\Server\Documents\thesaurus.csv (include .csv at the end of the name) and make sure its encoding is set to UTF-8
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”
Will this work for SharePoint Online?