Background: Recently I was working on creation of search result sources which were supposed to be used in one of my site collection for search results. But as I typed the query and clicked Test Query button it threw following error on my screen.
Error: Search display templates are not present on this collection. To add them, you need to activate the “Search Server Web Parts and Templates” feature on the Site Collection Features page.
Correlation ID: 7eeb4b9f-4bda-e0b6-987c-03d72906086b
Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.
Template ‘~sitecollection/_catalogs/masterpage/DisplayTemplates/System/Control_QueryBuilderPreview.js’ not found or has syntax errors. (LoadTemplate:)
Cause: Looking at the error from first four lines, it clearly says that Search display templates are not present on this site and “Search Server Web Parts and Template” feature need to be activated. By default this feature is not activated on newly installed sharepoint. And because of which Control_QueryBuilderPreview.js does not exists.
Activating the “Search Server Webparts and Template” feature.
- SharePoint 2016 Management Shell as admin.
- Type the command and execute:
Enable-SPFeature SearchWebParts –url http://<Central Admin Url>
Re open “Build Your Query” page and everything should work perfectly!
Thanks for reading
Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.
Stay tuned on Knowledge-Junction.