0

I've successfully created a new People display template (Item_Person.html) and associated result type, and used it on the peopleresults.aspx page. Now, I'm trying to achieve the same effect on the results.aspx page. According to @matthew-mcdermott in this post, it is using the Item_Person_CompactHorizontal.html display template so I've copied that template and created a corresponding result type. However, I cannot get the custom display template to be used on the results.aspx page. If I explicitly choose that template, it will show my changes but it does not when I select the template based on the result type.

Moreover, I cannot seem to locate an existing search service result type that utilizes the Item_Person_CompactHorizontal template, so perhaps this customization is not possible without editing the original template?

I've also documented my issue here, with screen shots.

1

The Item_Person_CompactHorizontal display template is triggered by a query rule on the Local SharePoint result source called "People Name in SharePoint Search".

Look up the query rules in the site collection site settings. Filter by Local SharePoint and you will find one called "People Name in SharePoint Search". When you view the settings, you will see that it adds a result block called People named {subjectTerms}. View the settings for the result block and you will see that it uses an item display template called "People Intent Item". That is the title of Item_Person_CompactHorizontal.

To make search use your display template instead, copy the OOTB query rule and tweak the settings in the result block. Once saved, make the OOTB version inactive.

EDIT After I wrote this, I realised that you tagged the question as O365. I only use on-premises so I can't confirm this all works exactly the same. From what I read, it should be though. I've fixed the link above to point to the SharePoint Online docs instead.

Licensing

Tracy pointed out that query rules that add result blocks or change ranked results are only available on certain O365 plans. Look for "Query rule - advanced actions" under the search section.

  • 1
    You are my hero! That was exactly the information I needed, and I wish I could say that it worked. The first obstacle is that the 'Copy' functionality does not appear for work for site or site collection query rules, I got an 'Unexpected' correlation ID error when trying. Not a big deal - just copy/paste the settings from the original by hand. I deactivated the original, but I'm still not seeing the new display template in my 'People' block. One interesting point of note is that my new site collection query rule says 'Enterprise users only'. – Tracy Aug 31 '15 at 23:17
  • I figured out why I still was not seeing the change; there is another query rule titled "Queries commonly performed in People Search" which was firing (thanks to my frequent test search of the same person's name) and using the OOB display template. My guess is that there are a number of OOB query rules that may be unpredictably applied to the Everything (Local SharePoint Results) result set, making it difficult to override all instances of an OOB display template. – Tracy Oct 7 '15 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.