04-12-2019 11:32 AM - edited 04-08-2020 04:49 PM
04-12-2019 11:32 AM - edited 04-08-2020 04:49 PM
We heard from many of you the need to be able to change the scope of your modern search results pages. When you create a new communication site or team site in SharePoint Online today, and type into the search box, you are taken to the modern search results page. This page shows results from your current site by default, and allows you to expand the scope of your search to the hub that the current site is associated with (if there is one), or to the whole organization.
But there is a desire for being able to change the behavior to always search over the whole organization, or across the hub a site is associated with, without needing an additional click, especially if the site in question will be used as a modern landing page for your organization.
I'm happy to say that with the latest version of the SharePoint PnP PowerShell extensions, it is possible to run a simple command as the site owner, and make your site use the organization, or the hub scope by default.
To change this setting:
1. Start PowerShell in administrator mode as you will be installing the PnP extensions.
2. Run the following commands to in this order:
PS C:\WINDOWS\system32> Install-Module SharePointPnPPowerShellOnline
# If you previously had installed this module, you may need to use the "-Force" parameter to install the newer version.
PS C:\WINDOWS\system32> Connect-PnPOnline -Url https://contosodemosg.sharepoint.com/sites/Strategy -UseWebLogin
# this will prompt you to sign into your site. Use the site owner credentials to sign in
PS C:\WINDOWS\system32> $web = Get-PnPWeb PS C:\WINDOWS\system32> $web.SearchScope = 1
# 1 for Tenant, 2 for Hub, 3 for Site, 0 for default behavior
PS C:\WINDOWS\system32> $web.Update() PS C:\WINDOWS\system32> Invoke-PnPQuery
After running these commands, the site will start to show results from the whole organization.To go back to the default setting, run the commands again with the value provided to "SearchScope" parameter to 0.
To search across the Hub, use 2 as the SearchScope value.
We will be providing a way to set this setting using the UI in a future release as well.
Updated in April 2020 to reflect the ability to search across Hubs.
08-05-2019 11:59 AM
@Kerem Yuceturk - Suggestion you may already have on your list.
Search result returns the site title. Problem is it also returns the web address name of the list and library instead of the title which would be more user-friendly.
Example: Document resides in a library with the title of "Employee-New" . Web address for the library is newterm.
08-26-2019 10:42 AM
08-26-2019 10:47 AM
@Kerem Yuceturk Thanks for the tip. Worked as you described. The only think I noticed is on the modern site I changed when you do the initial refresh of the page the search object says "Search in Sharepoint" when I return to the original page it says "Search in your organization"
It still searches across our tenant so the search is working just the description doesn't seem right
Thanks again for the tip and the powershell code
08-27-2019 08:11 PM
@chuckingerman, thank you for reporting this. We filed a bug on this and will address it as quickly as possible.
08-27-2019 08:12 PM
@RahulBrill, looks like a permission issue. Sorry it is hard to provide more guidance than that remotely. I'd look into all the security groups involved to make sure you have access, or try another admin user.
08-31-2019 11:33 AM - edited 08-31-2019 11:36 AM
09-01-2019 06:21 AM
09-01-2019 06:28 AM
09-12-2019 07:08 AM
@Kerem Yuceturk : Thanks for post, it is really helpful. I have two questions
1) Can we configure Modern SharePoint site search with the enterprise search center site. i.e.add url of search results page in search settings of modern site?
2) Can we add two result blocks in one Query rule, In my case I am adding one from SP onprem remote url and one from SP online. At a time only one result block display results in Modern site search.
09-17-2019 12:57 AM
I run into a similar issue, maybe someone has a good idea. I actually like the search scope to be at site level (like the default is), but have additionally the people search working for all our employees (AAD O365 accounts). Any trick to do that without coding stuff myself?
09-25-2019 06:57 PM
10-09-2019 02:11 PM
@Kerem Yuceturk I did found a way to execute the command.
it needs a tenant access right to execute the statement otherwise you end up in error.
10-24-2019 04:32 AM
@Kerem YuceturkWhat about SharePoint Server 2019 On-Premise? Could you give us an appropriate solution?
10-26-2019 08:18 AM
I am trying to search for a document by the tenant search (contos.sharepoint.com/search ) and using the search query tool but I don't get any result. The column contains separator dot (e.g PCE 234.56) no result is returned nut when i search with the title of the document , results are returned for the same document.
I have created a managed property (searchable,query-able, Language, matchable, langauge, tokenization ) mapped to the crawled property.
Please any idea
01-10-2020 09:48 AM
@Kerem Yuceturk Has there been any update to this? We are deploying our intranet and we have the scope set to just what it is out of the box which gives us results from the sites connected to our intranet hub. The problem is that it doesn't give us the people search capability. When I set the scope to include all of SharePoint, I feel like our results are cluttered up with a lot of information and even OneDrive. Will we be able to add in the people Search without all of SharePoint?
01-12-2020 02:55 AM
@Joe Volk we are in the same situation for our Intranet deployment, We've gone down the route of tweaking the search so that it does include all of SharePoint, primarily so that people and promoted results are returned. What we really need is the ability to scope SharePoint search to a hub / collection of Hubs but have the ability to showcase People and / or promoted results.
In the latest version of SPFX I have seen a preview feature on search customisation which might help: https://developer.microsoft.com/en-us/sharepoint/blogs/announcing-sharepoint-framework-1-10-extendin...
That being said, having more options to control search via PowerShell / UI is a must I think for Intranet deployment.
02-20-2020 04:02 PM
@Kerem Yuceturk I'm curious on the status as well. This is something important to the success of our newly launched intranet. Being able to set a site to search across all sites in the hub will be a huge win.
02-22-2020 09:37 AM
Hi @Colleen Parker and everyone,
We are working on adding setting the search scope to hub capability now. Please stay tuned. My best estimate for availability would be around April.
02-22-2020 09:40 AM
@Joe Volk , @Max Goss , as you pointed out promoted results/answers as well as people are only available at the organization level, and not at site and hub levels. This is due to the challenge of not being able to easily scope these entities to the sites and hubs we are dealing with. While we don't have any plans on this at the moment, I am sending your feedback to some of my colleagues to consider. We will enable some capabilities to customize the verticals in the second half of the year as well.
At the moment, building a custom results page could be one solution for meeting this scenario.
02-22-2020 09:41 AM
Hi @Vadimg, sorry, this capability is only on SharePoint Online at the moment.
by Kerem Yuceturk on April 12, 2019
by Mark Kashman on January 30, 2020