Oct 07 2020 05:54 PM
I have a site with several libraries. One has legacy content, a few others have current content.
I want the "Search this site" search to exclude the legacy library, but I also need to be able to navigate to the legacy library and use the "search this library".
How do I configure this? When I exclude the legacy library from the search results via "Library Settings > Advanced Settings > Allow items from this document library to appear in search results > No" -- then I don't get any results when I search inside the library.
Any ideas? This is for the MODERN experience. Please no suggestions about classic pages.
Oct 07 2020 11:22 PM
The scenario that you are talking about isn't possible with the settings that you have mentioned as you have found out.
You want to be able to search the content in the library from the library which means the content has to be indexed. The setting you mention excludes the content from the index.
Result sources can be modified to exclude content but I haven't found a way to exclude a library only a site. The only thing I could think of is moving the content to a new site, create a new result source, exclude the new site and make that the default for all sites.
Oct 08 2020 01:43 PM
@Andrew Hodges Yes, that's my workaround right now. Thanks for confirming.
Oct 08 2020 04:17 PM
@Andrew Hodges You say "Result sources can be modified to exclude content". Can you explain how?
I moved the legacy library to a sub site, but now the search results contain documents from the sub site. What do I need to do to remove the sub site results from the "Search this site" results???
Oct 08 2020 05:29 PM - edited Oct 08 2020 05:35 PM
Oct 08 2020 05:29 PM - edited Oct 08 2020 05:35 PM
SolutionFound it. It's a bit fiddly to set up. I configured the Result Sources for the site ( not the site collection or the tenant) this way:
According to the KQL syntax reference, it is possible to add multiple conditions for the same property, so I can include several libraries -- and by including only some, at the same time exclude others like this
{searchTerms} Path:"https://thetenant.sharepoint.com/sites/thesite/LibraryA" OR Path:"https://thetenant.sharepoint.com/sites/thesite/LibraryB" OR Path:"https://thetenant.sharepoint.com/sites/thesite/LibraryC"
Oct 08 2020 05:29 PM - edited Oct 08 2020 05:35 PM
Oct 08 2020 05:29 PM - edited Oct 08 2020 05:35 PM
SolutionFound it. It's a bit fiddly to set up. I configured the Result Sources for the site ( not the site collection or the tenant) this way:
According to the KQL syntax reference, it is possible to add multiple conditions for the same property, so I can include several libraries -- and by including only some, at the same time exclude others like this
{searchTerms} Path:"https://thetenant.sharepoint.com/sites/thesite/LibraryA" OR Path:"https://thetenant.sharepoint.com/sites/thesite/LibraryB" OR Path:"https://thetenant.sharepoint.com/sites/thesite/LibraryC"