Try our conversational search powered by Generative AI!

Find v13.2.6.0 - Unified Search - Storing Lists as part of SearchMetadata

Vote:
 

Hi All, 

I've ran into a problem that I'm hoping someone can help me with.

I've written a unified search solution, but need a way of storing additional metadata to items I'm surfacing in search, that will be used to filter against, and build facets from. 

The information I need to store against the unified search items are originally entered via properties decorated with SelectMany attribute (essentially a collection of checkboxes in the CMS UI, stored as a comma separated string)

[SelectMany(SelectionFactoryType = typeof(EnumSelectionFactory<T>))]
        [Display(
            Name = "Document Type",
            Order = 50)]
        [Required]
        public virtual string DocumentType { get; set; }

I then want to ideally store this information as a List<string> but there is nowhere on an ISearchContent type where I can assign the value - there is only one property on this type thats of type IEnumerable ("Categories" - ref: https://world.episerver.com/documentation/developer-guides/search-navigation/NET-Client-API/searching/Unified-search/), but I will need to store many lists of strings - not just the one example above, but up to 6-7 lists potentially. 

I then need to called TermsFacetFor extension on my unified search, which is of type ISearchContent, to get the facet information for the lists of strings im storing. 

It looks like my options are limited with ISearchContent - can anyone advise where to go from here? 

There was a similar question asked to this 4 years ago, and the answer related to including new fields in the indexer conventions, but I don't see how I can do that for ISearchContent - if I add a new fields using an extension method, it isn't added on index:

SearchClient.Instance.Conventions.ForInstancesOf<ISearchContent>()
.IncludeField(x => x.AdditionalList());

https://world.episerver.com/forum/developer-forum/EPiServer-Search/Thread-Container/2016/6/facet-in-unifiedsearch-for-metadata/

Thanks!

Paul 

#226102
Edited, Aug 04, 2020 17:08
* 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.