Factors that can affect search outcomes in SharePoint

Factors that can affect search outcomes in SharePoint

Searches from the search bar on a SharePoint Online site can sometimes return unexpected results. My previous post titled ‘How the search scope returns search results in SharePoint‘ explored how the search scope setting can influence results.

Searches in SharePoint Online (from sites, hub sites, the end-user SharePoint portal or via Teams) generally produce good results for most end-users ‘out of the box’, even without any customisation or scopes. Accordingly, it can be annoying and off-putting for end-users to experience unusual or unexpected search outcomes.

This post summarises eight potential factors in SharePoint Online that can affect search outcomes, including from Teams or the end-user SharePoint portal. If you know of others, please let me know in the comments.

  1. No access/permissions
  2. Finding too much or ‘sensitive’ content
  3. Content from a library or site does not appear in search results
  4. Searches are returning results from unexpected sources (1)
  5. Searches are returning results from unexpected sources (2)
  6. Searches from ‘Search this site’ are returning tenant results
  7. Search results are wrong or unexpected
  8. Search results are a mix of content and none of the above options fixed the problem

1 – No access/permissions

If you don’t have access to something in SharePoint then it won’t appear in search results.

This might seem an obvious statement but it can be annoying for end-users who thought they should be able to access something (or could do so before).

The default (and ideal) access control model on all SharePoint sites (including Teams-associated sites) is that the permissions are set at the site level (including Teams Owners/Members, and also site visitors) and are inherited ‘downwards’ by all content stored on the site. This means that end-users who can access the site should be able to find any content on that site.

However, if the inherited permissions model is broken and unique permissions are applied at the folder or document level, end-users with access to the site may no longer be able to find what they are looking for. This outcome can be both annoying and frustrating for end-users, especially if others in the same team can find or access the content.

Note that Site Owners should never be removed from any access controls on a SharePoint site. If there is a reason to remove the Site Owners, then perhaps a new site should be created, with different Site Owners.

Related to this issue is when certain legacy SharePoint features are enabled at the Site Collection Admin level. For example, the feature ‘SharePoint Service Enterprise Site Collection Features’ (which is NOT required in SharePoint Online) creates a new permission group called ‘Excel Services Members’. In some cases, the enabling of this feature can result in some people losing access and so not being able to find content via searches.

How to fix this issue

The ability to ‘fix’ this issue depends on whether (a) there was a reason for applying unique permissions and (b) the end-user searching for the content in question should be granted access to it. This is not always a given and should always be investigated first, usually with the Site Owners or with whoever created the unique permissions. It is not difficult to inadvertently remove someone’s access.

Assuming an end-user can be granted access, the two ways to fix this issue are to either:

  • Remove unique permissions in order to re-inherit the default site permissions, or
  • Add the end user to the unique permissions

To fix the Excel Services issue, de-activate the ‘SharePoint Server Enterprise Site Collection Features’ feature, remove the Excel Services Members from the permission groups, and then check the default Owners, Members and Visitors permissions again.

2 – Finding too much or ‘sensitive’ content

The opposite of not being able to find the required content is to find too much content or content that appears to be of a sensitive nature.

How to fix this issue

If end-users complain of finding too much content, it may be useful to show them how to improve their search queries, or to use filtering options from the first search, as shown in the screenshot below.

If an end-user indicates they have found (or even accessed) something that appears to be sensitive in nature, the Site Owners should be contacted and the matter should be investigated. Where necessary, temporary changes should be made to permissions to restrict access if the permissions appear to have been set incorrectly. If ‘SharePoint Viewers’ has been enabled as a feature it will be possible to see who has viewed the content in question.

3 – Content that can be accessed in a library or site does not appear in search results

If an end-user can access a site or library, but the content doesn’t appear in searches, , it could be that the following settings on either the library or even the site have been changed. These are normally ON by default.

  • Site: Site Settings > Search and Offline Availability > Indexing Site Content > Allow this site to appear in search results.
  • Library: Library Settings > Advanced Settings > Search > Allow items from this document library to appear in search results.
Site Search and Offline availability
Library search availability option

When either of the above is set to ‘No’, content in the site or library will not appear in search results for end users but they can still access it directly.

How to fix this issue

Check both the settings shown above. If either is set to ‘No’, check with the Site Owner/s if this was deliberate or perhaps a mistake, and change them to ‘Yes’.

Note that preventing library content from appearing in search results can be an effective way to ‘hide’ content from appearing in searches. The site or library and content in it can still be accessed directly (including via Site Contents) – the library itself does not disappear.

4 – Searches are returning results from unexpected sources (1)

The default result source in SharePoint is ‘Local SharePoint Results’. This means that a search from a site will find results in that site by default.

An end-user may instead see other options. To find out what the default result source is, Site Owners should navigate to Site Settings > (Site Collection Administration section) > Search Result Sources.

Search Result Sources for a Site Collection. The site Result Sources (under ‘Search’ in Site Settings’) has the same options.

How to fix this issue

If ‘Local SharePoint Results’ is no longer the default option, take a note of what the default is and ask the Site Owner/s if there was a reason to change it. There may be a reason for this change.

Otherwise, click on the drop-down option next to the words ‘Local SharePoint Results’ as shown in the screenshot above, and select ‘Set as default’.

5 – Searches are returning results from unexpected sources (2)

Similar to the previous issue, searches may be returning results from unexpected sources. Another reason why this can happen is because the SharePoint admin, Site Collection admin, or even Site Owner (if they are a Site Collection admin) has created a Search Center at the site collection or site level. There is usually no reason to create different Search Centers in SharePoint Online.

To know if a Search Center has been created, go to:

  • Site Collection Admin level: Site Settings > (Site Collection Admin section) > Search Settings (/_layouts/15/enhancedSearch.aspx?level=sitecol).
  • Site level: Site Settings > (Search section) > Search settings (/_layouts/15/enhancedSearch.aspx?level=site)

The screenshot below shows the default settings for both the site collection and site levels. If these are different, then the reasons for that should be investigated.

Site collection level search settings
Site level search settings

How to fix this issue

There may be a reason why a Search Center has been created at the site collection or site level, and this should be investigated first with the SharePoint or Site Collection admins.

To fix this issue (if there is no reason to retain the modified settings), return the settings to the default as shown above.

6 – Searches from ‘Search this site’ are returning tenant results

In April 2019 Microsoft announced (via the post ‘We’re improving search usage reports in SharePoint Online‘ on the Tech Community site) that they would change the way search worked from SharePoint sites to make it easier to find tenant-wide content. The change was made through the default search scope applied to all SharePoint sites.

Example search showing ‘Organization’ (tenant search) and the option to search the tenant also

The three search scopes are:

  • 1 – Tenant (‘Organization’ in the screenshot above)
  • 2 – Hub (not shown in the screenshot above)
  • 3 – Site (the default option set for the tenant, which usually shows as ‘0’)

If the search scope for an individual site OR the entire tenant is changed to ‘1’, end-users will see tenant results first when they search from a site. This can be confusing as the default is to return (a) the site results first and offer (b) the hub (if there is one), then ‘Organization’ (for the tenant).

To find out what the search scope is set on an individual site, right click on the front page and click on ‘View Page Source’ in the browser. Then search for ‘searchScope’. These two words should appear at least two times, one of which should be as shown in the screenshot below.

‘searchScope’ in the page source

If the searchScope is set to ‘2’ or ‘1’, this may be the reason why searches are returning results from the hub or tenant from the initial site search.

How to fix this issue

Fixing this issue at an individual site level requires the SharePoint administrator (or Global Admin) to run the PnP PowerShell script shown below.

  • PS C:\WINDOWS\system32> Install-Module SharePoint PnPowerShellOnline
  • PS C:\WINDOWS\system32> Connect-PnPOnline -Url https://tenantname.sharepoint.com/teams/sitename -UseWebLogin
  • PS C:\WINDOWS\system32> $web = Get-PnPWeb
  • PS C:\WINDOWS\system32> $web.SearchScope = 0 (or 1 or 2 or 3)
  • PS C:\WINDOWS\system32> $web.Update()
  • PS C:\WINDOWS\system32> Invoke-PnPQuery

(For additional details including how to set the default search scope for all sites, see this Microsoft Docs site: ‘Set-PnPSearchSettings‘).

7 – Search results are wrong or unexpected

Unusual search results may be caused by a problem with the back-end index. This situation is not as common with SharePoint Online as it was with SharePoint on-premise, but it could still be a problem. If none of the above options have worked, it is worth trying if all the above issues have been examined and discarded.

How to fix this issue

Reindexing a site is very simple and can be performed by the Site Collection Admins (who may also be the Site Owners, depending on how the site was set up).

Navigate to Site Settings > (Search section) > Search and Offline Availability; the reindex option is the last option in the list.

Reindex site option

Note: When you click on this option a message will appear saying that reindexing ‘may cause massive load on the search system’. It may also results in fewer results while the reindexing is taking place (behind the scenes and according a schedule, not immediately). Accordingly, reindexing should be run out of hours.

8 – Search results are a mix of content and none of the above options fixed the problem

If all the above has failed to resolve issues with search, there is a possibility that an older version of the SharePoint master pages are causing a flow-on affect to the ‘search.aspx’ page that displays the results. Updating the two master pages may fix the issue.

The relationship of master pages to web part pages, including search.aspx

How to fix this issue

Step 1 – The Site Owner should navigate to the master pages library for the site that has issues; there may be other clues to this problem including issues with the page layout generally. Add the text in bold at the end of the site name as shown:


The following should be displayed:

Master pages on a standard modern team site (there are more options on classic sites)

Note the ‘Modified’ dates. If they are more than two years old, it is probably worth updating them.

Step 2: Now open one of the newest sites and navigate to the same location. The ‘Modified’ dates should be the same date when the site was created.

One by one, (not together, to avoid getting a zip file), click on the down arrow to the right of each master page and select ‘Download’. Note where the files have been downloaded to.

Step 3: Now open the site with the search issues, click on the FILES option at the top left, and select ‘Upload’.

Uploading the replacement master pages

You can upload both files together. They will replace the existing ones as new versions. This means that, if anything else breaks, you can always restore the previous versions by clicking on the down arrow then ‘Version History’. From the versioning section, select the down arrow next to last good version, then ‘restore’. You will be able to see who uploaded the file.

Confirm (visually) that the older version is back in place.

What if none of the above options work?

If none of the above options fix your search issue, you may have a more complex issue. In this case, submit a service request with Microsoft.

Feature image – Photo by Ketut Subiyanto from Pexels

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s