You can read more about it here. (https://world.episerver.com/forum/developer-forum/EPiServer-Search/Thread-Container/2018/6/filter-by-site-id-in-unified-search/)
We use FilterOnCurrentSite and put code like this in a InitializableModule
SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf<PageData>() .PublicSearchFilter(client => client.BuildFilter<PageData>() .FilterForVisitor() .FilterOnCurrentSite()); SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf<MediaData>() .PublicSearchFilter(client => client.BuildFilter<MediaData>() .FilterForVisitor() .FilterOnCurrentSite());
Thanks for your reply. That seems to be working. However we seem to hav an issue with content files indexing.
We have a couple of pdf files which are in the global blocks. These are referenced/linked only in our main site.
The other sub sites do not use these.
However in our subsites on a different domain we get these pdfs in the results.
If there some thing more which we need to do so that only content which are referenced in a page are returened in the search results.
We have created multiple sites in Episerver for our build.
The code is shared between all sites and is deployed to the DXC.
We would like to keep the search indexing and results to be exclusive within each site we have created.
What is the best approach to take here as we seem to have only one Episerver find index.
Currently our search results page is returning resuts from all sites as expected.