Searching for pages based on free-text content of associated MediaData

Vote:
 

Hello.

Is it possible to search (unified search) based on the name of the attached media data?

#290910
Nov 01, 2022 11:38
Vote:
 

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());       
    }
}
#290912
Nov 01, 2022 12:05
Vote:
 

Can you please give an example of implementation of GetNamesOfAllAttachedMedia?

Thanks in advance.

#290971
Nov 02, 2022 7:27
Vote:
 

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?

#290975
Nov 02, 2022 9:12
Vote:
 

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; }
    }
#290976
Nov 02, 2022 9:13
Vote:
 

The quickest solution would be adding the [IndexInContentAreas] 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 :-)

#290978
Edited, Nov 02, 2022 10:02
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.