Let me you explain a small tip on how to debug the display templates of your Content Search Web Parts in SharePoint in Google Chrome.
There will always going to be 2 files created for your display template. One is the .HTML file in which you would be working and the other is the .JS file which gets automatically created and used by SharePoint once you upload your .HTML file.
a. Open the page in which you have your CSWP.
b. Press Ctrl+Shift+J. This will open your developer dashboard.
c. Click on “Sources” from the tabs as shown below:
d. Expand _catalogs/masterpage and then Display Templates/Content Web Parts
e. You should be seeing the .JS file of your display template. Click on the .JS file to open it in the workspace.
f. Put a breakpoint anywhere and refresh the page and the page load would pause when the break point is hit in the display template as shown below:
g. From now you can debug like how you do in Visual Studio using F10 and F11.
There might be a requirement when there are no results returned from your CSWP’s query, you would still need to display some default content. Follow the below steps in order to accomplish this:
a. Edit your content search web part.
b. In the tool part, uncheck the option “Don’t show anything when there are no results.”
c. Open the control template of you content search web part, search for the below if condition:
d. The text or the HTML content that you give inside the above if condition would appear in your web part when it has no results to display. You may use it to display any custom empty message when there are no results returned.
Do you get this error that says “Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has “Full Read” permissions on the SharePoint Web Application being crawled.” while performing a crawl in SharePoint environment?
Googling will make you to check the value of “DisableLoopbackCheck” from the registry editor or check if the content access account has access to the DB or check if the content access account has “Full Control” permission in the service application.
Before or after you do all the above, please make sure that you have entered the correct or the latest password of your content access account in the search administration page. In the search service application.
If you have used or worked with SharePoint search, you must have come across the pagination control that appears in the bottom of the search results web part in the search results page.
This control came as a separate web part in SP 2010 where we had the below 2 properties in the tool pane that can be set to show the maximum no. of page links to be shown before the current page and the maximum no. of links to be shown after the current page.
Whereas in SP 2013 the pagination has become a part of the core search results web part itself and is being created in the control template of the web part (more on that later). And the above 2 properties of the pagination are not seen in the tool pane of the search results web part which came as a surprise to me.
Later, to my surprise when I exported the search results web part I was able to see the 2 properties in the .webpart file as shown below:
Setting the properties in the .webpart file and importing it back to SharePoint made the necessary changes in the pagination reflecting. Hope you find it useful.