Reputation: 1256
I've have two smart search index as experiments. One type is 'Pages', the other is 'Pager Crawler'.
My pages have a section, using a repeater, that is a custom page type. it renders out like this:
<div class="fullWrap pageBanner">
<div class="container pageHeading">
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="pageHeading--headingCopy">
<h1>This is the Home Page. Buy some RESPs.</h1>
<h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus volutpat posuere posuere.</h2>
<a href="/Learn-About-RESPs.aspx" class="btn btn-chevron">Learn More</a>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="pageHeading--heroImage">
<img src="/kffCorporate/media/KFFCorporate/headerImages/0-0_KFF_Home_Image-555px-gradient.jpg?ext=.jpg" class="img-responsive" alt="This is the Home Page. Buy some RESPs.">
</div>
</div>
</div>
</div>
</div>
Nothing too fancy, just a basic bootstrap fluid container, with two columns.
My search results, don't pick up any of the copy from 'pageHeading--headingCopy', but i do get the image url.
This is the output from the search transformation.
Registered Educational Savings Plans ~/kffCorporate/media/KFFCorporate/headerImages/home-benefits.jpg CTA Heading Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis luctus vehi...
and here's the relevant part of the transformation.
<%-- Search result content --%>
<div class="content">
<%#SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(CMS.ExtendedControls.ControlsHelper.RemoveDynamicControls(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"), ""))), false, " ")), 200, "...")), "<span class='searchTerm'>", "</span>")%>
</div>
I thought the transformation would pick up the first 200 characters of what's rendered on the page, but it's missing the H1 and H2, as well has other items. If i search against the copy in the H1 or H2, the page is returned in the result, but the content displayed in the search result that's off.
Any thoughts?
Upvotes: 1
Views: 281
Reputation: 528
For custom page types, you can define which fields from the page type line up with the designated search fields.
Go to your custom page type, and go to the "Search Fields" tab. From here, you can choose which fields will show up for the various search fields. In your case, you need to assign the "Content" field to the corresponding custom field.
Each search result item has this set of mapped fields, "Title, Content, Image, Date" which you can set to correspond with any field from your custom page type in order to make your search results more consistent and easier to manage. By default, the "Content" field lines up with "Document Content" which combines all of the editable regions on the page/page type. If the H1 and H2 are stored as separate fields however, it will not pick them up by default.
Upvotes: 3