Try our conversational search powered by Generative AI!

Dynamic content in SearchText



Dynamic content isn't renderd in SearchText extension. I guess that's fine. The span surrounding the DC is removed but not the actual content in it. So if a page has the PagePropertyPlugin and fetches a property from another page the text "" gets indexed. I think this should be removed also.

Feb 11, 2013 13:28

Good point. I will look into that.

Feb 11, 2013 14:40

Johan, have you found this with the CMS 6R2 integration or 7 integration?

Reason I'm asking is because I can see this happening for 6R2 but for 7 dynamic content *should* be rendered and indexed as XhtmlStrings are indexed as the return value of ToHtmlString(AnonymousPrincipalDude).

Feb 11, 2013 19:09

6R2 Joel. I guess some Regex-magic can get rid of the curly braces. I've already overridden SearchText and added some own content, so it wouldn't be a big effort to fix that.

But I thought I'd check with you guys first and see if you had a solution to the problem.

Feb 12, 2013 0:40


Not sure if it's related but there is a bug that the page property dynamic content does not handle rendering when calling prop.ToString() in EPiServer 7.

Feb 12, 2013 7:42

Ok, here is my solution... first remove the default implementation of SearchText and then add our.

    .ExcludeField(page => page.SearchText()) // Exclude the default SearchText
    .IncludeField(page => page.SearchText(true)); // Include our extened SearchText

And the actual implementation of our SearchText

public static string SearchText(this PageData page, bool extended)
    StringBuilder content = new StringBuilder();

    // Removes dynamic content plugins
    string text = Regex.Replace(page.SearchText(), @"\{\w+\}", string.Empty);


    // Add extra content from "tab pages"
    foreach (var tab in DataFactory.Instance.GetChildren(page.PageLink))
        if (tab.PageTypeID == Settings.Instance.TabPageTypeID)
            content.AppendLine(tab["TabHeading"] as string);
            content.AppendLine(tab["TabBody"] as string);

    return content.ToString().StripHtml();


Feb 12, 2013 15:10
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.