SharePoint Online: Remove a items in particular site collection from searches outside of that site collection

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/271391

Question

As the title suggests I'm trying to prevent people from finding items from a list in a particular site collection while still allowing the internal search of that site collection to work.

My Googling has only turned up answers to compeltely prevent a site or list from appearing in any searches ie. by either going into Search and Offline Availability and selecting No under "Allow this site to appear in search results" or No under "Allow items from this list to appear in search results".

As both of these options prevent users from searching items from a list while in the list itself it doesn't suit my purposes.

I've tried putting -path:https://xxx.sharepoint.com/sites/PI/ATE into the query builder and although this does stop the site from appearing it means that when there is nothing in the search box the results box is full of random items.

Is there another way to either modify the search box or search results box to exclude particular site collections? is -path:https://xxx.sharepoint.com/sites/PI/ATE the best I can do?

Was it helpful?

Solution

Since we cannot modify crawl rules in SharePoint Online, I would say yes, it is the best you can do.

And it is the default behavior of search result web part to automatically return all search results matching the search queries.

In addition, the modern search page of SharePoint Online doesn’t support customization currently.

Even if you modify the search box web part and search result web part, you can’t really prevent the site collection from appearing in the global search results, unless due to security reasons.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top