Recently, I had a client request to be able to search their public website from a page in SharePoint Online (SPO) web site. Knowing that there was an InternetSearchResults result source available by default in SPO, I knew that this should be easy to accomplish. But after working with SharePoint for over 10 years, I should have remembered that just because something can be done in SharePoint it may take more effort than expected to implement. The InternetSearchResults result source uses the OpenSearch 1.0/1.1 protocol and it turned out that there is virtually no documentation provided by Microsoft regarding the use of this protocol.
Paul Stork SharePoint Server MVP at Microsoft, provided me some clues in his response to a post on the Microsoft TechNet forum where a similar question was asked, but this did not provide me the full answer to my problem.
In the SP Admin Center, the Search page contains a link to Manage Result Sources. On this page, the InternetSearchResults source contains the following query:
Since this syntax calls search.live.com it is obviously quite old (Bing replaced Live around 2009). Even though it still functions, I decided that I would rather use bing.com. I did some research and found that:
- the acceptable parameters for an OpenSearch query are shown at OpenSearch parameters.
- the advanced search keywords for Bing at Bing Parameters
I thought that I would be able to simply add the parameter “site” to the end of the search query and set it to my client’s public web site domain as follows.
However, this did NOT work.
I did some testing and thinking and realized that since the “site” parameter is the most limiting value of the query that it would need to be at the beginning of the statement. Some other articles state that the “site” parameter can follow the Search Terms, but my tests did not confirm that syntax.
I found that a specific internet site could be searched in SPO (as well as other SP versions) by using the following syntax.
So, if you're looking to search the internet from your SharePoint Online site, this would be the simplest approach.