Sitecore - Indexing data from presentation compone

2019-02-07 08:00发布

问题:

I have a Sitecore site where many of the pages are assembled mainly from various sublayouts pointing at datasources elsewhere in the content tree.

Here's a basic example of the problem. Someone viewing a page about apples might see the word 'apple' 10 times. However, Lucene will not index the Apple page item for that word because it's stored in other items.

I'm sure this must be a common issue but I can't seem to find any advice on it.

回答1:

This is a common issue and there's a solution in this screencast at 38:29:

http://www.techphoria414.com/Blog/2012/May/Sitecore_Page_Editor_Unleashed

Grab the sample code on the page and look at the class PageEditor.Unleashed.Search.DynamicFields.VisualizationField which grabs all data sources and adds their content to the "_content" field in the config

<dynamicField type="PageEditor.Unleashed.Search.DynamicFields.VisualizationField, PageEditor.Unleashed.Classes" name="_content" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" />