Hi,
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
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"));
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";
});
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?
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.EnablePageFilesIndexing(); ContentIndexer.Instance.Conventions.ForInstancesOf<SitePageData>().ShouldIndexPageFile((content, file) => FileTypesToIndex.Contains(file.Extension));
where
private static readonly IList<string> FileTypesToIndex = new List<string> { ".doc", ".docx", ".pdf", ".txt", ".xls", ".xlsx" };
What am I missing? (EPiServer 7)
FileTypesToIndex is a list of file file extensions similiar to the one in Joel's blog post http://joelabrahamsson.com/entry/building-a-search-page-for-an-episerver-7-site-with-episerver-find
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.