Поделиться через


How to change the way search results are displayed in SharePoint Server 2013

SharePoint Server 2013 and SharePoint Online comes with many default search features that help users find what they’re searching for. But you might want your search results to look a certain way, for example, display information that’s specific to your company or business.

In this blog series, I’ll explain how you can customize the way search results are displayed. To help explain, I’ll use examples from a tool that I use on a daily basis: an internal list of Microsoft publications.

As you know, Microsoft publishes thousands of articles across TechNet, MSDN and office.com. To assist in the publishing process, we use several SharePoint lists. Each item in a list represents an article or a media file. To quickly find information about a list item, we’ve set up a Search Center that searches across all of the lists.
Throughout this series, I’ll show you how I’ve changed the way search results are displayed from this…

Default search result

... to this:

Customized search result

In this series, we’ll cover:

 

How search works in a few words

In case you’re not so familiar with how search works, here’s a high level representation that might be useful for this series.

Search overview

  1. Content is stored in lists and libraries. Site columns are used to store values, or in other words information, about each item in a list or library.
  2. When lists and libraries are crawled, site columns and the site column values are added to the search index.
  3. In the search index, site columns are “transformed” into managed properties. Site column values are “transformed” into managed property values
  4. On a search page, a user enters a query in a Search Box Web Part. The query is sent to the search index.
  5. Search results are sent from the search index to a search results page, and displayed in a Search Results Web Part.  The Search Results Web Part uses display templates that specify which managed property values should be displayed.

 

Here’s how to understand this high level representation in the context of Microsoft’s internal Search Center.

  1. A Microsoft writer creates a list item for an article she'll be writing. Site columns, such as Title, Content Summary and Technical Subject, are used to store values, or in other words, information, about the article.

List item

  1. The list has been marked for continuous crawl. This means that that the list will be crawled at a set interval, for example, every minute.You can see the crawl schedule in List Settings --> Catalog Setting.

Crawl schedule

  1. From Site Settings --> Search Schema you can search for managed properties.In my scenario, there’s a managed property named ContentSummaryOWSMTXT, and another one named owstaxIdTechnicalSubject. They represent the site columns Content Summary and Technical Subject (for more details about the “transformation” of site columns into managed properties, see the blog post From site column to managed property - What's up with that?).

Two managed properties

  1. On a search page, a user enters a query, for example customize search results.

Entered query

  1. On a search results page, search results are displayed in a Search Results Web Part. The Web Part uses display templates that specify that the values from the managed properties ContentSummaryOWSMTXT and owstaxIdTechnicalSubject should be displayed in the search results (the display templates specify many other things as well, but for now, let’s just concentrate on the values of these two managed properties). The second search result is the list item created in step 1. We can see that the values from the managed properties ContentSummaryOWSMTXT and owstaxIdTechnicalSubject are are displayed in the search result.

Search result

You can also see details such as a small icon next to each search result on the page. These icons represent the site to which the article is published, such as Office.com and TechNet . The search result also contains the words "Technical Subject" in front of the value search. I’ll show you how I added the icons and the words in later blog posts. But first, I'll tell you more about how search results are displayed.

 

Next blog article in this series
Understanding how search results are displayed

Additional Resources Overview of search in SharePoint Server 2013

Comments

  • Anonymous
    January 01, 2003
    hi bella,Its a very helpful post.Can you explain a little how paging in display template works?Especially on the part where on click of pagination a query string "#s" and "#k" is attached to the url?

  • Anonymous
    January 01, 2003
    Hi Colin, Thanks for that very nice feedback.   Although only my name appears on the blog, I have had A LOT of help from my great colleagues, so it is really a team effort.  And we are all happy to hear that you like the series :-) Bella

  • Anonymous
    January 01, 2003
    Hi Bella,
    Thank you for this series of posts! As I understand this information is not valid for Sharepoint Foundation 2013, because "DislayTemplates" folder have no any html files? Is there any way to solve this issue in Sharepoint Foundation 2013?

  • Anonymous
    January 01, 2003
    Hi mr.nik,

    I'm sorry, but I don't know how you can customize search results in SharePoint Foundation 2013.

    Bella

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Hi Jeremiah, I hope this series will help you. If not, I would really appreciate if you could let me know about any problems you are facing. We will do our best to help you as best as we can. Bella

  • Anonymous
    January 01, 2003
    Hi Ankit,

    I don't quite understand what you mean by CEWS.
    But, after you modified and saved your display template, did you see a Property Sync alert on your Manage Result Types page? (http://blogs.technet.com/b/tothesharepoint/archive/2013/09/11/how-to-display-values-from-custom-managed-properties-in-search-results-option-1.aspx#Modify1)

    Bella

  • Anonymous
    January 01, 2003
    Hi Fred,

    No, I don't have these articles for SharePoint 2010.

    Bella

  • Anonymous
    January 01, 2003
    Hi Hans, Thanks for the input :-) This is a very interesting use case, so I will look into possibly extending the series to include this. Bella

  • Anonymous
    January 01, 2003
    Hi Sumit,

    1. You can create a custom result source and configure it so that it only returns what you're looking for. In your specific scenario, you might have to use Keyword Query Language (http://blogs.technet.com/b/tothesharepoint/archive/2013/09/03/how-to-change-the-way-search-results-are-displayed-in-sharepoint-server-2013.aspx

    2. Sorry, I don't know how to do this.

    Bella

  • Anonymous
    January 01, 2003
    Hi Michael,

    It's a bit difficult for me to understand your exact situation, so I'll make a few assumptions.

    I'm assuming that you have an on-premises environment, and that you are using the Title managed property to display your results. If you go to the Search Schema in Central Administration,  you'll see that the Title managed property is mapped to several crawled properties. The order in which these crawled properties are listed is the hierarchy that is used to decide which crawled property value should be displayed. If the first crawled property is empty, the second crawled property will be used. If the second crawled property is empty, the third crawled property will be used etc.

    In your case, it sounds like you can move the crawled property Basic:10 (this is the crawled property that represents the file name) to the top of the list of mapped crawled properties.

    You'll have to do a full recrawl of your content for the changes to take place.

    For an overview of crawled and managed properties in SharePoint Server 2013, see this article: http://technet.microsoft.com/en-us/library/jj219630(v=office.15).aspx

    Hope this helps,
    Bella

  • Anonymous
    January 01, 2003
    I'm really looking forward to this series.  It will be very helpful for me! Thanks!

  • Anonymous
    January 01, 2003
    Hi Scott,

    I'm not sure if I completely understand your scenario, so could you give me a bit more details about what exactly you are trying to do?

    Also, I'm not sure if this applies to your situation, but have you had a look at the information in this article: http://technet.microsoft.com/en-us/library/dn130132(v=office.15).aspx

    Bella

  • Anonymous
    January 01, 2003
    Hi Koushik,

    SharePoint Server 2013 has many display templates that you can change to include custom managed properties. Which display template(s) you should change, depends on what type of search results you have.

    For information about display templates names as they are connected to result types, see this article:https://technet.microsoft.com/library/dn386874.aspx

    Thanks,
    Bella

  • Anonymous
    January 01, 2003
    Hi Edward,

    Sorry, I don't know the answer to your question. I suggest that you contact Microsoft Support.

    Thanks,
    Bella

  • Anonymous
    January 01, 2003
    Hi Revan,

    I'm sorry to hear that you're having problems getting things to work.
    Can you verify that after you've modified the display template, on the Manage Result Type page, that a Property Sync alert is shown? (http://blogs.technet.com/b/tothesharepoint/archive/2013/09/11/how-to-display-values-from-custom-managed-properties-in-search-results-option-1.aspx#Modify1

    Bella

  • Anonymous
    September 03, 2013
    It would be nice to extend this series with: How to show associated icons in the Refinement web part. theressomethingaboutsharepoint.blogspot.nl/.../refinement-web-part-show-associated.html

  • Anonymous
    September 08, 2013
    The comment has been removed

  • Anonymous
    December 27, 2013
    Pingback from How to change the way search results are displayed in SharePoint Server 2013 | Office 365 Singapore for Business - Win-Pro

  • Anonymous
    May 09, 2014
    Bella - Thank you so much for this very informative series! Finally, a great resource about customizing search.
    I have a situation where my client wants me to customize search so that keyword results are ranked highest in the search results. The problem I'm running into is that they are running in 2010 mode so lots of the settings & options that are normally accessible thru the 2013 UI are not available. I spoke with a SP dev friend & he suggested that I could access these now hidden settings & options via Visual Studio. He also suggested that I could stand up a separate web app to use as a dedicated enterprise search center.
    What are your thoughts?
    Thanks in advance!

  • Anonymous
    July 21, 2014
    The comment has been removed

  • Anonymous
    September 02, 2014
    Nice article Bella, let me know you if have any idea on masking the urls in sharepoint 2013 search results

  • Anonymous
    September 29, 2014
    How to change the way search results are displayed in SharePoint Server 2013 - SharePoint IT Pro Blog - Site Home - TechNet Blogs

  • Anonymous
    October 17, 2014
    Hi, do you have an equivalent articles for the exact same thing in Sharepoint 2010? thx!

  • Anonymous
    December 09, 2014
    It is a nice Article, Need an URGENT help, I basically have to queries,

    1. I am stuck at the search configure for SP 2013. I like to get the search results for a document library is the only the title or name of the document. That is if i do a search in the document library the result should not search for the keyword inside the document. It have to search for the name of the document.

    2. i have to integrate sharepoint calendar with the exchange calendar (I mean the meeting room calendar).

    Any Idea?
    Any help would be appreciated

    Thank you very much in advance for your kind help.

    Regards,
    SP~

  • Anonymous
    January 07, 2015
    The comment has been removed

  • Anonymous
    March 06, 2015
    Excellent blog posts Bella, very helpful!

  • Anonymous
    March 08, 2015
    Hi,
    Please let me know What is the display template name in which we can include managed property names, so that we can see them in search results.