Search Bit-Wizards
How to Configure the Content of Search Results in Kentico
 searching

How to Configure the Content of Search Results in Kentico

If you use Kentico Smart Search on your website, you may wonder exactly where the title and preview text for each result comes from. If you are familiar with Search Engine Optimization, your first guess is most likely that they originate from the meta page title and description. While that is where Google and Bing get the title and summary text from, Smart Search in Kentico works a little different.

Unlike Google and Bing, Smart Search gives you a good bit of control over how it indexes the content on your website. We won't cover how to create the indexes in this post, but we will talk about how to control how your content appears in the search results. Specifically, there are four pieces of data you control for each result: the title, the summary or content, an image and a date.
kentico search result example
Each document or page within a Kentico site is of a specific type. These types are naturally called Page Types. The most common Page Type is the Page (menu item) which serves as a general content page. Other Page Types are used to create structured content such as blog posts, news articles, FAQs, events, and more. When it comes to Smart Search, each Page Type gives you the ability to configure various aspects of how those types of documents are treated in regards to search. You can control aspects such as which fields are included in the search index and how they can be searched, but what we are concerned with in this case is how these documents appear in the search results.

You can find a list of all Page Types in the system by navigating to the Page Types module. To see the search settings for a given type, you must click to edit that Page Type and then go to the Search Fields tab. This tab has two main sections with three set of functions. The first is simply the top most setting which indicates whether or not search is enabled. This setting determines if these types of documents should be searchable at all. Next, are the four fields below this setting. These control how your documents will display in the search results, and we will talk about them in a minute. Lastly is the grid section at the bottom. These are the settings that determine which fields are included in the index and how they can be searched, however, we will talk about that in a separate blog post.
search field configuration window
The four fields that control which results are output are the Title field, Content field, Image field, and Date field. The information required for these fields is pretty obvious except that Content might be a bit misleading. You may think that the Content field requires the content for what is being searched, but in fact, it is the field that determines the summary text for the search result. Each of these fields is "asking" which field from the Page Type it should get the content to use for Title, Content, Image, and Date values of a search result. Depending on how your development team has built the layout of your search results, you may or may not be using the Image and Date values at all. Also, not all Page Types will have an Image or Date field as those may be irrelevant base on the type of data the Page Type represents.
kentico search result
If you notice that documents appearing in the search results are missing the summary or displaying an incorrect date, the most common cause is that these values are not set correctly. You will need to go into these settings for those Page Types and ensure they get updated as necessary. 

Most of the common issues we encounter around these fields occur when a custom page type is created, but the search settings are never updated. When you create a custom Page Type, Kentico sets default values for each of these settings based on the underlying document settings that are common to all page types. In most cases, these are not what you want. For example, the default for the content field is DocumentContent, which "looks for" any content in an editable area on the Page tab. The problem here is that most structured documents don't use this generic content field and instead use specifically defined fields. In this case, you will need to change the content field from DocumentContent to the field name for defined field that contains the content that should be used as a summary. Similarly, the default for the date field is DocumentCreated but in most cases, this is not optimal because you use workflow or post-date your content because it will be published sometime in the future. This is another case where you need to change the date field from DocumentCreated to the field that contains the correct date that you would like to use.
 
That’s how simple it is to control this aspect of search within your site. I hope you find this tip valuable and can use it to optimize user experience through search on your site!

Author

Wiz E. Wig, Mascot & Director of Magic
Wiz E. Wig

Director of Magic