Exclude media items saved against "For This Page" from Find index

Vote:
 

Hello,

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 

#251289
Edited, Mar 24, 2021 13:16
Vote:
 

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").

#251430
Mar 25, 2021 20:58
Vote:
 

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. 

#251431
Mar 25, 2021 21:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.