Office 365 Content Search Display Templates
I'm going to be starting a series of articles that outlines how to work with Search, Display Templates, Result Types and Result Sources. The first of this series will target specifically the Content Search web part, and some Office 365 gotchas.
One of the biggest challenges I find when working with display templates, is getting your custom managed properties to show up. Mikael Svenson wrote a really interesting post recently on how to retrieve your managed properties 100% of the time. You can learn more about that here: https://techmikael.blogspot.com/2014/04/the-100-way-of-getting-your-custom.html.
However, I don't believe the above applies to the Content Search web part, as it does not leverage Result Types, which is a Search Results specific setting. If I compare the screenshots below, Content Search doesn't allow me to specify a Result Type, where as Search Results does.
|Search Results||Content Search|
On a related note, it's really important to understand that with respect to display templates, these two web parts do differ slightly. MSDN has a good post that outlines which display templates can be used in each of the different web parts: https://technet.microsoft.com/en-us/library/jj944947(v=office.15).aspx.
If you're interested in learning why you'd use one over the other, Benjamin has a good post on this as well. To summarize, the main difference is the ability in Content Search to specify the Managed Properties you want to use without having to edit the Display Template.
Now back to the point that initiated this post, why the heck won't my custom managed properties show in my o365 display template? Please also note, that from my experience, these issues aren't as persistent on prem. As long as we're following the instructions for setting up the managed property and updating our display template, I've never had any issues showing the data in my custom managed properties.
With o365, we have the added challenge of dealing with latency when it comes to the Search Service. We don't control the frequency with which our data is crawled. Chris writes a great summary on this that is a must read.
So if we don't control how quickly content appears in Search, what can we do? Well MS does give general guidance on this, and I've read some users having to wait upwards of a day before their content will appear or show as updated. In addition, you can specify at the List/Document or Site level that you want to force a Reindex of your content. However, I've had limited success with this.
The best way to get an idea of whether or not your data has been re-crawled is to leverage a tool called SharePoint 2013 Search Query Tool v2. With this, you can connect to your o365 tenant, and run a query against your data to determine if your managed properties are being populated, and if not, why.
As you can see in the screenshots above, the last time that particular piece of content was crawled was back in November. So any custom managed properties I hope to leverage won't populate until this is re-crawled. This is the key piece of information to note.
For me, it always came down to the fact that the data had not been re-crawled AFTER I had setup my managed property. Even though I'd asked SharePoint to reindex as per this article, it made no difference. Eventually the data was crawled, but I had no visibility into how it decided when to crawl it, or why it took so long. As Chris points out, in my mind, this is a real issue, that I hope we see MS address in the near future.
If anyone has an experience or feedback with this issue specifically, please leave a comment!
It’s Time To Transform
Let us show you how much easier your work life can be with Bonzai Intranet on your team.