Try our conversational search powered by Generative AI!

Excluded items are still being indexed



I have excluded items from being indexed by Search & Navigation, but they are still indexed. I have this initialization module:

    public class FindInitialization : IInitializableModule
        public void Initialize(InitializationEngine context)
           ContentIndexer.Instance.Conventions.ForInstancesOf<MyPageType>().ShouldIndex(x => false);
           ContentIndexer.Instance.Conventions.ForInstancesOf<BlockData>().ShouldIndex(x => false);

But the blocks and MyPageType are still being indexed. 

Any tips on what I am doing wrong?

Feb 23, 2021 11:45

Two things off the top of my head

  1. Did you clear the index down and re-index
  2. You may need to change the module dependency to [ModuleDependency(typeof(IndexingModule))]
Feb 23, 2021 14:19


  1. Yes, I have cleared the index multiple times, even tried to change index.
  2. That didn't help either.
Feb 24, 2021 13:53


I figured out why this is happening. There are block types from an earlier version of the solution - epi 6, that are generated in admin, and not in code.
They reside as nodes in the page tree. 

Is it possible to exclude specific nodes from the indexing, or do I need to tell them to replace all the blocks with newer versions?

Mar 04, 2021 6:55

You can probably use Ancestors to filter out the pages belong to specific nodes, given that you know their content references 

ContentIndexer.Instance.Conventions.ForInstancesOf<T>().ShouldIndex(x=>!x.Ancestors().Contains("the node content link"))
Mar 04, 2021 9:10

Yes, but since they are created in admin, I don't have a type to put in for 'T'. I will try with PageData.

Edited, Mar 04, 2021 9:33

Yes go with PageData or even IContent. 

Mar 04, 2021 9:56
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.