Hello SharePointer 🙂
Till now we have seen the quick facts for display template in my previous blog post.Here, I am going to explain further more points to look over before we actually implement the requirements.
Very first requirement in order to have content on web part is running mode of Search Service and the next is enabled publishing feature in site.In SharePoint Online, Search service will be taken care by Microsoft 🙂 and you are good to go to work with Search Web parts for On Premises or Online SharePoint Site.
Alright, at this point we will have look on content what we can display as per the need. Actually ,there are two types of web part we can use to leverage the search:
- Content Search Web part: Specifically meant to display your content/products in designed view using dedicated display templates.
- Search Results Web part: Specifically meant to modify the view of search results via display templates.
Actually, the content we use from search considered as results types whether its collection of page/post/site/email/Image etc. which are associated with specific display templates as explained in Microsoft article.
Both the web parts concentrated with more similar functionality, however the purpose of using them is a bit different. I have also mentioned the different types of settings availability in both the web parts as demonstrated in following table:
The best part of these web parts is that it gives you the facility to build up the custom query via query variables to filter the items from selected result types.For more information about query variables to be entered in Keyword filter and Property Filter, please have a look on this Microsoft article.
AND -> Last but not least, Search Web parts are security trimmed by default and you don’t require to control user’s security setting explicitly 🙂 , I am loving it !!
Note: We can also use the content query web part to display the content however it will display the results only from the current site collection while Search web parts are leveraging the cross-site publishing feature and that’s much faster than content query web part.CQWP results are rendered by XSLT ( XML file ) while CSWP results are rendered display Templates ( HTML file ).Please have a look on this article that explains understanding about deciding CSWP or CQWP.
Next we will look over on customization of Search web parts .
Stay Gifted,Stay Young !