Try our conversational search powered by Generative AI!

Index block contents when in XhtmlString property

Vote:
 

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?

#141659
Nov 17, 2015 17:08
Vote:
 

Here is one way to do it: http://world.episerver.com/blogs/Per-Magne-Skuseth/Dates/2016/1/episerver-find-index-blocks-in-xhtmlstring/

#143567
Jan 27, 2016 7:35
Vote:
 

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?

#221332
Apr 16, 2020 11:45
Vote:
 

I think you are guessing correctly! :-)

#221337
Apr 16, 2020 12:52
Vote:
 

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

#221342
Apr 16, 2020 13:47
Vote:
 

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

#221346
Apr 16, 2020 14:33
Vote:
 

Thanks for the clarifications!

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