SharePoint 2013 Thesaurus for People Search not working RRS feed

  • Question

  • Hi,

    Is there a limitation in SharePoint? Thesuarus is not working for People Search.

    I have a userprofile attribute 'Additional Appointment' single line text with values like Human Resource Manger, Senior Manger etc.

    we also have a thesaurus as below

    HR,Human Resource Manager,en
    SM,Senior Manager,en

    When we search for HR in people search there are 0 results. If we search for Human Resource Manger there are results.

    How to make this thesaurus work in People Search? Please help.

    Wednesday, March 29, 2017 3:30 AM

All replies

  • Hi,

    Here is a workaround for your reference:

    #Setup the Thesarus Dictionary
    $PeopleThesaurus = @{}
    $PeopleThesaurus.Add('Human Resources',@("HR"))
    $PeopleThesaurus.Add('Business Travel',@("Travel Team", "Travel Department"))
    #Profile Attribute Ignore List (Warning, case sensitive)
    #$IgnoreList = @("Department","Team","SPS-JobTitle","Title")
    $IgnoreList = @()
    #UPS People Thesaurus Attribute
    $ThesaurusAttribute = 'PeopleThesaurus'
    #Get the My Site URL Replace the <MySites URL with your url
    $siteUrl = "http://me/"
    #Get the Site Context
    $site = Get-SPSite $siteUrl
    $servcontext = Get-SPServiceContext $site
    #Initiate the Profile Manager and get the user profiles
    $profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($servcontext)
    $profiles = $profileManager.GetEnumerator()
    #Initiate the Config manager to get all the profile properties
    $upConfigManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($servcontext);
    #Attribute to test if Employee exists
    $employeeIDAttribute = "PreferredName"
    # Loop through all user profiles.
    foreach ($uProfile in $profiles)
      # Make sure there is some value in the employee ID property
      if ($uProfile[$employeeIDAttribute] -ne '') {
        #Set the profile commit flag so we don't save unchanged profiles
        $save = $false
        #Get the users Thesaurus Attribute
        $PersonThesaurus = $uProfile[$ThesaurusAttribute]
        #If they already have items in the Thesaurus set save to true and clear it (Removes stale entries, will rebuild later)
        if($PersonThesaurus.Count -gt 0) {
            $save = $true
        #Create an array to store the dictionary keys for the user
        $personDictionary = @()
        #Loop all UPS attributes and look for Thesaurus entries
        foreach($upConfigManagerProperty in $upConfigManager.GetProperties()) 
          if($uProfile[$upConfigManagerProperty.Name] -and 
             !$IgnoreList.Contains($upConfigManagerProperty.Name) -and
             $upConfigManagerProperty.Name -ne $ThesaurusAttribute -and
             ) {
            foreach($key in $PeopleThesaurus.Keys) {
              if($uProfile[$upConfigManagerProperty.Name] -match $key) {
                    $personDictionary += $key
                    $save = $true
        if($personDictionary.Count -gt 0) {
            Write-Host $uProfile[$employeeIDAttribute]
            foreach($item in $personDictionary) {
                foreach($entry in $PeopleThesaurus[$item]) {
                    Write-Host " " $entry
                    $x = $PersonThesaurus.Add($entry)
        if($save) {
            #Write-Host "" # New line

    A similar thread as below:

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Thursday, March 30, 2017 6:51 AM
  • Hi Dennis,

    Thank you for the reply.  I will try and update you on this.

    Saturday, April 1, 2017 10:54 PM