Try our conversational search powered by Generative AI!

EnablePageFilesIndexing does not process ForInstancesOf<UnifiedFile>().ShouldIndex()

FileIndexer.Instance.Conventions.ShouldIndexVPPConvention = new VisibleInFilemanagerVPPIndexingConvention();
FileIndexer.Instance.Conventions.ForInstancesOf<UnifiedFile>().ShouldIndex(x => FileTypesToIndex.Contains(x.Extension));

FileTypesToIndex is a list of file file extensions similiar to the one in Joel's blog post   

In this list I don't have .jpg. Still .jpg files from PageFiles are added to the Index and show up in UnifiedSearchFor.
What do I need to do in order to have the same ShouldIndex-check for PageFiles?

This project is EPi 7 and the latest version of the module.

Jan 07, 2013 10:43


The PageFiles handling is done by the ContentIndexer so in order to filter PageFiles you have to change the ContentIndexer conventions:

ContentIndexer.Instance.Conventions.ForInstancesOf<IContent>().ShouldIndexPageFile((content, file) => FileTypesToIndex.Contains(file.Extension));

/ Henrik

Jan 07, 2013 13:39

Great! Thanks!

Jan 07, 2013 14:20

Is it possible to have multiple Global ForInstancesOf? such as:

            PageIndexer.Instance.Conventions.ForInstancesOf<PageData>().ShouldIndex(page => page.PageTypeName.StartsWith("[ExtensionSys] Text"));
            PageIndexer.Instance.Conventions.ForInstancesOf<PageData>().ShouldIndex(page => page.PageTypeName.StartsWith("News - Article"));
            PageIndexer.Instance.Conventions.ForInstancesOf<PageData>().ShouldIndex(page => page.PageTypeName.StartsWith("Content Page - 3 Columns"));


Mar 03, 2013 19:58

You can pass a full fledge delegate instead of a lambda expression:

PageIndexer.Instance.Conventions.ForInstancesOf<PageData>().ShouldIndex(page => 
return page.PageTypeName.StartsWith("[ExtensionSys] Text") || page.PageTypeName.StartsWith("News - Article") || page.PageTypeName.StartsWith("Content Page - 3 Columns"; });


Edited, Mar 04, 2013 0:55

Great, that sounds good - Im getting the actual Composer name from the Search such as CF__1218_8296_4521_12887, is there a way to get the actual Page where it is referenced so the user can click through to the page and for FIND to show the Excerpt too?

Mar 04, 2013 9:50

I have tried tried with following code in my Global.asax.cs file but I still get  jpg-files from page files

            ContentIndexer.Instance.Conventions.ForInstancesOf<SitePageData>().ShouldIndexPageFile((content, file) => FileTypesToIndex.Contains(file.Extension));


        private static readonly IList<string> FileTypesToIndex = new List<string>

What am I missing? (EPiServer 7)

Nov 27, 2014 14:24
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.