There is a flues in EPiServer Form which all uploaded file can be indexed. To exclude uploaded file using EPiServer Form -> FileUploadElementBlock from EPiServer Find indexer you can go:
[ModuleDependency(typeof(InitializationModule))]
public class EPiServerFindInitialization : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
ContentIndexer.Instance.Conventions.ForInstancesOf().ShouldIndex(ShouldIndexDocument);
}
public void Uninitialize(InitializationEngine context)
{
}
bool ShouldIndexDocument(DocumentFileBase documentFileBase)
{
if (contentAssetHelper.Service.GetAssetOwner(documentFileBase.ContentLink) is FileUploadElementBlock)
{
IEnumerable result;
ContentIndexer.Instance.TryDelete(documentFileBase, out result);
return false;
}
return true;
}
readonly Injected contentAssetHelper;
}
Jorma Kallela
January 7, 2019 — 9:13 pm
Hi Aria, we are trying to exclude form documents from Find as you have shown. We just do not understand where can we find declaration for DocumentFileBase. Can you kindly help us?
zanganeh
January 10, 2019 — 3:23 pm
Hi jorma.. I will look for sample code as this is for long time ago .. bare with me ..