Try our conversational search powered by Generative AI!

Index block contents when in XhtmlString property


Is it possible to index the contents of a block, when it's rendered inside an XhtmlString property, in a similar fashion as in the ContentArea property using the IndexInContentAreas attribute?

Nov 17, 2015 17:08

Here is one way to do it:

Jan 27, 2016 7:35

Is there a way to do this when access to pages and blocks are restricted?

I have a page with restricted access, and the page itselt is indexed (there is text in AsViewdByAnonymous) but the blocks in the xhtmlfield (MainBody) on the page are not indexed. I used the solution in Pers blog post. My guess is that "xhtmlString.Fragments.GetFilteredFragments(PrincipalInfo.AnonymousPrincipal)" is filtering out all blocks?

Apr 16, 2020 11:45

I think you are guessing correctly! :-)

Apr 16, 2020 12:52

Yes but why? And why are not everything in MainBody filtered out since access is restricted?

Apr 16, 2020 13:47

Pages are by default indexed regardless of restrictions. You would use FilterForVisitor() during querying to exclude those with restricted access.

Apr 16, 2020 14:33

Thanks for the clarifications!

Apr 16, 2020 18:01
* 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.