Today, I’ll discuss about the Result Types. If we do little bit googling we will get very good articles / blogs on Result Types.
Few good references for details of Result Types:
So here I’ll not go in delve of Result Types but will discuss the use case (scenario) we have and how we implemented with the help of Result Types.
Use Case: We have a portal and which contains many article pages, news pages and links. We have requirement like on our main portal home page we need to show the 5 article pages, news pages and links. So total 15 items. All we need to show in such way like have common background for all 15 items without any gap in between different type of result but different presentation to identify those. Like before link there should be “>>”, news pages item should show the modified date and article pages item should show the author.
Like as shown in following example, with yellow background (this is just exampleJ)
Article 2 Author
Article 3 Author
Article 4 Author
News Item 1 Modified date
News Item 2 Modified date
News Item 3 Modified date
News Item 4 Modified date
We have decided to implement this requirement with Search, so in any approach we will require at least three Display Templates.
1. Initial thought in our mind is 3 Content Search web parts adding in one zone and in page layout add this zone in Div tag so that we can have common background for all the web parts. But this approach has one drawback. We need to add three Content Search web parts. On our portal already we have 4-5 search web parts so we are little bit concerned about performance and then maintenance. Need to maintain the three web parts.
2. Second approach, my team member suggested the Result Types. So we just need to create three result types and set rules like if Article page content type then apply article page display template, if News Article content type then apply news display template and if link content type then apply link display template. And then we will require only one Search Result web part and need to configure the Search result web part to use Result Types as follow:
|Fig 1. Configuring Result Types in Search result web part|
So here at least our performance and maintenance related problem is solved since we are using only one Search Result web part.
So basically here I want to focus on Result Types which are used to display result differently. But Result Types are available only with Search Results web part.
Enjoy reading J
Feel free to comment / feedback if any or if you have any query J