Thesaurus
In this article we can explore the Thesaurus and its configuration in a SharePoint 2013 Search.
What a Thesaurus is
The words Thesaurus and Synonym mean the same thing.
Purpose of a Thesaurus
Users might have difficulty in typing lengthy search texts like:
1. Human Resource
Instead, they can use a pre-configured Thesaurus like:
- HR
- HRA
How to specify a Thesaurus for SharePoint 2013 to Search
First we need to create a comma-separated Thesaurus CSV file like the following.
Key, Synonym, Language
HR, Human Resources, en
HRA, Human Resources
The language parameter is optional.
How to configure a Thesaurus
We need to use PowerShell scripts to configure a Thesaurus.
Practical
Let us try to configure Thesauruses as an exercise.
Step 1: Initial Empty Search
Try searching for HRA and ensure you are receiving no results.
![HRA]()
This confirms there are no content matching the text HRA.
Step 2: Create Thesaurus file
Create a CSV file with the following content.
Key,Synonym,Language
HR,Human Resources
HRA,Human Resources
Save the file.
Step 3: Install the Thesaurus file
Run the following PowerShell script to install the Thesaurus file.
- # Add PowerShell Snapin
- if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
- {
- Add-PSSnapin "Microsoft.SharePoint.PowerShell"
- }
- $searchApp = Get-SPEnterpriseSearchServiceApplication
- Import-SPEnterpriseSearchThesaurus -SearchApplication $searchApp -Filename "\\server\c$\temp\file.CSV"
The path should be in UNC format. Please change the server and file names appropriately.
If the installation succeeded, you will get the following message.
Step 4: Test the Search
Back in SharePoint, repeat the search using the text HRA. You should receive the following results.
![Test the Search]()
This confirms the successful configuration of the Thesaurus. Please note that the results are immediate.