AI OnAI Off
Do you need them to be indexed as the same object or is it enough that you can search them as if they where the same? If thats the case you could extract an interface from your pagetypes and use that when searching.
They are complex in the meaning that they inherit some properties from their parent if they havnt overritten it so the default serializer can't handle it so I have to do a custom part anyway,
I found out how to do it. Here is my code:
ContentIndexer.Instance.Conventions.ForInstancesOf<ProduktbladGY>().ShouldIndex(ShouldIndexEducationPage);
private static bool ShouldIndexEducationPage(PageData page)
{
var shouldIndex = page.CheckPublishedStatus(PagePublishedStatus.Published) && page.GetPropertyValue<string>("MetaRobots") != "NOINDEX, NOFOLLOW";
var educationToIndex = page.ConvertToIndexObject();
var find = new EPiServerFind();
if (!shouldIndex)
{
try
{
SearchClient.Instance.Delete<EducationInfoToIndex>(page.PageGuid);
}
catch
{
//ignore
}
}
else
{
try
{
SearchClient.Instance.Index(educationToIndex);
}
catch
{
//ignore
}
}
return false;
}
I always returns false since I do not want to index the orginal Items.
I have five PageTypes that are exactly the same and I wan't them to be indexed as one object. I do it today by doing my own schedule job that do the indexing and a custom index of it in global.asax but I wan't to do it in the ContentIndexerConfig-class on some more smarter way. We are planning to make it one pagetype but there is a lot of work around that so it is not possible right now.
Are there any way to do this?
/Henrik