November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I think this can be easiest achieved if you add a list of attached media files as a new property in the index for all pages.
Something like this, just implement GetNamesOfAllAttachedMedia().
[InitializableModule]
[ModuleDependency((typeof(EPiServer.Web.InitializationModule)))]
public class InitialiseSearch : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
SearchClient.Instance.Conventions.ForInstancesOf<MyBasePage>().IncludeField(x => x.GetNamesOfAllAttachedMedia());
}
}
Can you please give an example of implementation of GetNamesOfAllAttachedMedia?
Thanks in advance.
The implementation would depend on how you plan on attaching media data.
Do you reference the media data from one specific property? Or multiple properties?
What property types would be used to reference the media?
I am using a Content area where I have a custom block from where I add Files. Here is my files block
public class DocumentListBlock : SiteBlockData
{
[Display(GroupName = SystemTabNames.Content, Order = 100)]
[AllowedTypes(new[] { typeof(GenericMedia) })]
public virtual ContentArea Files { get; set; }
}
The quickest solution would be adding the [] atttribute to DocumentListBlock and GenericMedia/ImageFile, like described here:
https://world.optimizely.com/blogs/pjangid/dates/2019/4/indexing-blocks-content-to-make-it-searchable/
You could then use the [Find] > [Overview] > [Explore] feature in the Optimizely UI to check that the filenames are actually indexed as part of the page.
So, just forget my previous suggestion :-)
Hello.
Is it possible to search (unified search) based on the name of the attached media data?