Using search in modern sites

Brass Contributor

Without getting a complete answer (what the future will bring) I can see from earlier posts that people have asked if it’s possible to change/configure default search in a modern Communication Site? Example of this would be to send the query to a custom search page. After search input you are redirected to a standard search page (_layouts/15/search.aspx). Will there be any support for changing this behavior? I have tried with different search settings, both on Site and SiteCollection level without any result.

 

Reason for my question is that I have a customer that have invested heavily within the Enterprise Search templates. There is a lot of query rules, display templates, search verticals and refinements. From a classic Team Site there is an option to search (via search input box) for Everything (it's also possible to configure this URL on tenant level to a custom search center).

 

Customer would like to use the new communication site as a landing page but it’s important to keep the classic Enterprise Search as default for “site” search, also from modern sites (or optionally).

 

With this option it would be much easier to combine a common search behavior when you have good mix of classic and modern team/collaboration sites. Is there perhaps a plan to “deprecate” the classic Enterprise Search functionality and this is the reason for not being able to reconfigure the search?

 

Would an option be to build a custom header (with help of SharePoint Framework Extension) that implements a custom search box? Follow up question is how you easiest could remove the original search box in that case? Most flexible solution would be to implement support for the search box to make use of the search settings like the classic input search. 

 

Any input around this topic would be appreciated :)

5 Replies
Until support for using the standard search settings...SharePoint Framework Extension together with jQuery solves the replacement of a new search box. :)

Hi Örjan, your solution, is that also for SharePoint online? Thanks in advance! 

Only did a POC but this was done in SharePoint Online (Office 365)
Thanks for your reply, could you help me a little? I saw you can download sfx but how do you implement it Finally in SPO? With powershell?

Sorry for late response. This is a development framework so you need to code. 


Have a look here to getting started:

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/build-a-hello-world-exte...

 

Look for implementing an application customizer and make sure that jQuery is referenced

import * as jQuery from 'jquery';
 
To reference the placeholder containing search box
jQuery(".ms-compositeHeader-searchBoxContainer").html("Replaced");
 
This just replace the placeholder with text but you can extend this to use a custom search box or adding custom event to the already existing inputbox.