Epinova / Epinova.Elasticsearch

A search-plugin for Episerver CMS and Commerce
MIT License
29 stars 20 forks source link

Media files requires preapproved file extensions to be indexed #214

Open stefanolsen opened 2 weeks ago

stefanolsen commented 2 weeks ago

Using this plugin in Optimizely CMS, I would like to index the metadata of all media files, in order to be able to search for them in the asset pane.

However, I do not want to index the binary content of all media files, as attachment content. In the same way, I would like to index all MediaData instances without specifying all possible file extensions in configuration. This, I believe, should only be needed for attachment indexing.

Is it possible to not rely on file extensions when indexing MediaData instances? And instead rely exclusively on indexing conventions?

otanum commented 2 weeks ago

This is how it was designed. You have to specify all extensions that should be indexed and binary data for

        private static readonly string[] BinaryExtensions = new[]
        {
            "jpg", "jpeg", "gif", "psd", "bmp", "ai", "webp", "tif", "tiff", "ico", "jif", "png", "xcf", "eps", "raw", "cr2", "pct", "bpg",
            "exe", "zip", "rar", "7z", "dll", "gz", "bin", "iso", "apk", "dmp", "msi",
            "mp4", "mkv", "avi", "mov", "mpg", "mpeg", "vob", "flv", "h264", "m4v", "swf", "wmv",
            "mp3", "aac", "wav", "flac", "ogg", "mka", "wma", "aif", "mpa"
        };

are excluded automatically.

otanum commented 2 weeks ago

You could probably write you own GetFileTypes() in your solution and use IncludeFileType like

BorgKristian commented 2 weeks ago

We will not include this as part of the module. This can be resolved within the project as @otanum suggests above.