none
Job Title with Ampersand gets duplicated.

    Question

  • Hello,

    I am having an interesting issue with the out of the box core results web part when displaying people results whose title contains an ampersand. Snapshot attached. The first instance of the ampersand appears a bit strange so I am not sure if it is an character encoding issue. I have also put a breakpoint in item_person.js and it appears that search is returning the duplicate title. The infrastructure is running the March PU.


    <Lambros />

    Monday, May 13, 2013 9:06 PM

Answers

  • We too were having this issue. I have the User Profile Service Application configured to sync with Active Directory. We have "physicalDeliveryOfficeName" mapped to the "Office" field on the user profile.

    I was able to workaround this issue by altering a copy of the Item_Person display template \\<web app uri>\_catalogs\masterpage\Display Templates\Search\.

    I added the following line to the JavaScript at the job title section.

    $parsedTitle = displayJtitle.split("\n")

    Then overwrote the corresponding DIV like this:

    <div id="JobTitleValue" class="ms-srch-ellipsis" title="', encodedJtitle ,'"> ', $parsedTitle[0] ,' </div>'

    Hope this helps.

    • Proposed as answer by Cory Syvenky Wednesday, February 5, 2014 10:16 PM
    • Marked as answer by Lambros Vasiliou Friday, February 7, 2014 1:41 PM
    Wednesday, February 5, 2014 10:09 PM

All replies

  • We are experiencing the same exact issue. I saw a post in the SharePoint 2010 forums that said this problem was fixed with a CU, but that was for SharePoint 2010.

    Here is the thread I was referencing

    User titles containing "&" are double after upgrade to March CU

    • Edited by Brandon S Sunday, December 15, 2013 11:57 PM Additional Info
    Sunday, December 15, 2013 9:57 PM
  • We too were having this issue. I have the User Profile Service Application configured to sync with Active Directory. We have "physicalDeliveryOfficeName" mapped to the "Office" field on the user profile.

    I was able to workaround this issue by altering a copy of the Item_Person display template \\<web app uri>\_catalogs\masterpage\Display Templates\Search\.

    I added the following line to the JavaScript at the job title section.

    $parsedTitle = displayJtitle.split("\n")

    Then overwrote the corresponding DIV like this:

    <div id="JobTitleValue" class="ms-srch-ellipsis" title="', encodedJtitle ,'"> ', $parsedTitle[0] ,' </div>'

    Hope this helps.

    • Proposed as answer by Cory Syvenky Wednesday, February 5, 2014 10:16 PM
    • Marked as answer by Lambros Vasiliou Friday, February 7, 2014 1:41 PM
    Wednesday, February 5, 2014 10:09 PM
  • We too were having this issue. I have the User Profile Service Application configured to sync with Active Directory. We have "physicalDeliveryOfficeName" mapped to the "Office" field on the user profile.

    I was able to workaround this issue by altering a copy of the Item_Person display template \\<web app uri>\_catalogs\masterpage\Display Templates\Search\.

    I added the following line to the JavaScript at the job title section.

    $parsedTitle = displayJtitle.split("\n")

    Then overwrote the corresponding DIV like this:

    <div id="JobTitleValue" class="ms-srch-ellipsis" title="', encodedJtitle ,'"> ', $parsedTitle[0] ,' </div>'

    Hope this helps.


    Fantastic although I was hoping for a fix from Microsoft :)

    <Lambros />

    Friday, February 7, 2014 1:42 PM
  • I encountered this same issue.

    Upon closer inspection of the SP User Profile (https://www.spsite.com/[SitecollectionName]/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v=%27[domain]\[EmpID]%27) we found the job title appeared in three XML elements:

    ...
    <d:Title>Boss &amp; Mgr</d:Title>
    ...
    <d:UserProfileProperties>
       <d:element m:type="SP.KeyValue">
          <d:Key>Title</d:Key>
          <d:Value>Boss &amp; Mgr</d:Value>
          <d:ValueType>Edm.String</d:ValueType>
       </d:element>
       <d:element m:type="SP.KeyValue">
          <d:Key>SPS-JobTitle</d:Key>
          <d:Value>Boss & Mgr</d:Value>
          <d:ValueType>Edm.String</d:ValueType>
       </d:element>
    ...

    That difference in ampersands is because the first few are standard HTML encoded while the last one one is a Unicode Fullwidth Ampersand. I'm guessing Search is unable to collapse the title into one either because of this.

    Anyone know more about how to resolve this at the source?

    Wednesday, March 25, 2015 9:39 PM
  • After adding

    $parsedTitle = displayJtitle.split("\n")

    We found the corresponding DIV had to be changed to:

    <div id="JobTitleValue" class="ms-srch-ellipsis" title="_#= encodedJtitle =#_"> _#= $parsedTitle[0] =#_</div>

    Thanks very much

    Monday, March 7, 2016 7:43 PM
  • know this is old - but doesn't change it in my Environment  - can someone see if this is correct;  


    if(has_jt == true) {
    ms_outHtml.push(''
    ,'                                            <div id="JobTitleField">'
    ); 
                                                    var encodedJtitle = $htmlEncode(ctx.CurrentItem.JobTitle);
                                                    var displayJtitle = Srch.U.getSingleHHXMLNodeValue(hhProps, "jobtitle");
    												$parsedTitle = displayJtitle.split("\n")
                                                    if ($isEmptyString(displayJtitle)) { displayJtitle = encodedJtitle }
    ms_outHtml.push(' '
    ,'                                                <div id="JobTitleValue" class="ms-srch-ellipsis" title="_#= encodedJtitle =#_ "> _#= $parsedTitle[0] =#_  </div>'
    ,'                                            </div>'
    ); 
                                            }
    ms_outHtml.push(''
    ); 


    • Edited by JmATK Tuesday, February 14, 2017 7:34 AM
    Tuesday, February 14, 2017 7:23 AM
  • I know this is old, but I just ran across this and found another way to solve this without having to change the item template that might be more favorable to some admins.

    As of writing this, we are using SP 2013 CU 0ct 2016.

    I went in and changed the managed property for "JobTitle" so it only includes content from the first crawled property and then moved up People:title over People:SPS-JobTitle so it doesn't have the fancy "&" 

    My guess is that when the mapping is set to include all content, it displays each unique value of the mapped properties and that due the the difference between the values of "Title" and "SPS-JobTitle" you get both values returned.

    • Proposed as answer by tleducCDN Monday, April 10, 2017 4:02 PM
    Monday, April 10, 2017 4:01 PM
  • Hi tleducCDN 

    Yes that was also a fix :) 

    Tuesday, April 11, 2017 5:45 AM
  • We have this issue on SharePoint 2013 December 2017 CU as well as SharePoint 2013 August 2018 CU.  A few users had their titles changed to include & and they are showing duplicates..., I'll test above workaround out.
    Tuesday, January 22, 2019 4:17 PM
  • Thank you much!  I had same issue 2 years later and this fixed the issue.
    Tuesday, April 9, 2019 7:22 PM