We are running into an issue where Find is indexing media items that are saved in the CMS against "For This Page", which I think is intended functionality.
The issue is that the page it is saved against could be unpublished or maybe is restricted access, and this is causing issues with search results where documents are appearing but cannot be accessed, throwing errors.
Could someone please point me in the right direction to exclude media items from the Find index if they are saved against "For This Page"?
Essentially only indexing media items that are saved against "For This Site" or "For All Sites".
I'm working on Find 13.2.10, CMS 11.20.1
Thank you for any help, it is much appreciated
First of all, Epi Find should not give you a page if it is unpublished. You probably need to use Filter for Visitor before while getting results back from Find.
Episerver already has a built-in job to remove unrelated assets ("Remove Unrelated Content Assets").
In theory, you can exclude items from being indexed by doing code like below in the Initialization module
ContentIndexer.Instance.Conventions.ForInstancesOf<[ContentTypeName]>().ShouldIndex(x => false);
But in your scenario, it will be problematic. (This is how I understand)
if your target page unpublished/restricted then you might want to remove the media item from the index, to do that you need to clear and index the whole Find index.