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

Vote:
 

Hi,

     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 13.2.6.0. 

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

        [Display(
            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
{
        [Required]
        [Display(
            Name = "Title",
            Order = 50)]
        [MaxLength(240)]
        public string AccordionTitle { get; set; }

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

[PropertyDefinitionTypePlugIn]
public class AccordionItemListProperty : PropertyList<AccordionItem>
{
       
}

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

Thanks,

Rams

#253963
Edited, Apr 27, 2021 9:24
Vote:
 

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

#253968
Apr 27, 2021 13:54
Vote:
 

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.

Thanks,

Rams

#253972
Apr 27, 2021 14:02
Vote:
 

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.

#253976
Edited, Apr 27, 2021 18:45
Vote:
 

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

#254016
Apr 28, 2021 9:36
Vote:
 

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>())
#254017
Edited, Apr 28, 2021 9:36
Vote:
 

Thanks Tomas, that did the trick. But eventually, we ended up doing the implementation as mentioned in this blog https://world.episerver.com/blogs/Per-Magne-Skuseth/Dates/2016/1/episerver-find-index-blocks-in-xhtmlstring/ as the requirement got changed for the entire system.

#255210
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.