Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

IList<T> that are used in blocks are not indexed as expected



     We have an implementation where accordion items can be added as IList. The issue we are having is when the IList items are added to Html Editor, we can see the content as AsViewedByAnonymous in Index. But the search from CMS does not bring the content back where the keyword is part of IList as shown below. We are using Epi Find API version 

public class AccordionTest 
            Name = "Accordion Blocks",
            Description = "Accordion Content Items",
            GroupName = "Accordion",
            Order = 400)]        
	public virtual ContentArea AccordionBlocks { get; set; }

            Name = "Accordion Items",
            Description = "Accordion List Items",
            GroupName = "Accordion",
            Order = 500)]
        [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<AccordionItem>))]
        public virtual IList<AccordionItem> AccordionItems { get; set; }

public class AccordionItem
            Name = "Title",
            Order = 50)]
        public string AccordionTitle { get; set; }

            Name = "Content",
            Order = 100)]
        public XhtmlString AccordionContent { get; set; }

public class AccordionItemListProperty : PropertyList<AccordionItem>

Any ideas why this is happening and ways to make the content appear on CMS Search?



Edited, Apr 27, 2021 9:24

How do you write your query? Not a Find expert but I think you need to use MatchContained for your property

Apr 27, 2021 13:54

Hey Quan,

    Authors wanted to see the output in CMS search from the nav top bar (in the edit screen of CMS) and not by code.



Apr 27, 2021 14:02

I just testet with an IList<T> property on mediafiles. The content of IList<T>-properties are not searchable for mediafiles either.

I tested both in the top navigation, and the search bar in assets pane.

Edited, Apr 27, 2021 18:45

It's expected, unfortunately. What you can try is to implement your search provider, extends EnterpriseContentSearchProviderBase, and make sure that you use MatchContained for your property. You likely can do that in AddContentSpecificFields

Apr 28, 2021 9:36

The top navigation search and assets pane search will search the properties Name and SearchText.

The easiest will be adding a property named SearchText  to your AccordionTest class, and include your accordion items.

public string SearchText => this.SearchText() + " " +
     string.Join(", ", AccordionItems?.Select(x => x.AccordionTitle + " " + x.AccordionContent?.ToHtmlString(PrincipalInfo.AnonymousPrincipal)) ?? Enumerable.Empty<string>())
Edited, Apr 28, 2021 9:36

Thanks Tomas, that did the trick. But eventually, we ended up doing the implementation as mentioned in this blog as the requirement got changed for the entire system.

May 20, 2021 12:25
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.