Forum Discussion
Kerem Yuceturk
Microsoft
Apr 12, 2019Configure modern search results to search all of your organization (rather than the current site)
Hey everyone,
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.
Searching in a site will show results from that site (Strategy and Planning), with a control to expand the search scope to the hub (Sales) or the whole 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.After the change, results from the whole organization are displayed.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.
Hi Rick DeFoe, we are actually working on making that happen. We hope that will be coming in the next couple of months.
- AGoneauBrass ContributorWhat would be really nice would be a drop down menu in the search box that allowed the user to select their own scope (this site, this hub, organization, people, etc).
- AndrewWarlandSteel ContributorCan someone confirm they get similar outcomes to what I describe here?
I'm working with an agency in a large multi-tenant organisation. When end-users search from a SPO site with'Search this site', the search URL contains /siteall?q=queryword and the search returns from other sites in the tenancy that the user appears to have access to. This is confusing when they only searched 'this site'.
I understand this to mean that the SearchScope is set to '1' (Tenant). Is this now the default setting for all sites (is 0, the default behaviour, actually '1'?)
Clicking on 'Organisation' doesn't change the search results (still includes other sites in the tenancy) but the search URL no longer has the /siteall element.
Am I right in saying the only way to fix this (to restrict search results to just that site) is to run the PnP script and change the SearchScope to '3'?
Thanks in advance. - hportCLBrass Contributoris there the ability to set a scope to search a couple of hubs? Our intranet is the main hub but we have 2 others that we'd like the following to happen:
Intranet hub - search hub and the other 2
the other 2 just search within their own hub. - Mateusz_Orlowski1910Copper Contributor
Kerem Yuceturk what's the difference between SearchScope = 0 and SearchScope = 3?
Is there a global setting which determines the search scope so I can change it globally?
- Robin ThakurCopper ContributorA bigger issue here is being able to exclude sites from tenant wide searching without disabling search on them. We have users that want their site to be searchable to them when they are on the site but don’t want people finding results on it from the Intranet which is scoped to use tenant wide searching. Currently there is no solution for this and especially when the site has lists where all users can create new items, this means they are all visible through the search to everyone.
- ArefHalmstrandSteel Contributor
Kerem Yuceturk
Here is also an video instruction for those who would like to see how to configure modern search results.
https://www.youtube.com/watch?v=6WS2vkYqs7g&ab_channel=ArefHalmstrand
Yours sincerely,
Aref Halmstrand - Nels1590Copper Contributor
Please let me know how to configure the search from certain site hubs and not from the entire organisation? I have a requirement and I am looking to configure the search from a few site hubs only.
- GaryRaboen079Copper Contributor
I've just completed this task in Powershell, see below, but when I'm on the landing page and search for the site, the extra click to search the whole organization is still needed. Not a single command has come with an error whatsoever.
What am I doing wrong, or is it some other setting that needs to be changed?
- Andrew GoodwinBrass Contributor
Kerem Yuceturk
A step in the right direction but still very limited and short-sighted. But we need even more flexibility than this.We also need to be able to define explicitly certain sites or multiple hubs.
For example, an organisation has built an intranet which is comprised of several hubs. We need to be able to set the search scope to "the intranet" and therefore be able to specify multiple hubs.
Also, for example by wildcard in URL's. If we have defined a naming convention with a prefix, for let's say projects. All project sites have the prefix 'proj-'. We need the search scope to be able to be defined for "all project sites".
Honestly, the scenarios are pretty much endless. - Alla_FCopper Contributor
Kerem Yuceturk , Is there a way to Remove"Organization" scope link? We would like to limit users to only search within hub and hub sites, not to show "organization" at all.