Try our conversational search powered by Generative AI!

Excluded items are still being indexed

Vote:
 

Hi!

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

 [InitializableModule]
    [ModuleDependency(typeof(InitializableModule))]
    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?

#249054
Feb 23, 2021 11:45
Vote:
 

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))]
#249065
Feb 23, 2021 14:19
Vote:
 

Hi!

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

Hi!

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?

#249547
Mar 04, 2021 6:55
Vote:
 

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"))
#249553
Mar 04, 2021 9:10
Vote:
 

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

#249555
Edited, Mar 04, 2021 9:33
Vote:
 

Yes go with PageData or even IContent. 

#249556
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.