YaleSites utilizes the Drupal Core Search feature that allows site visitors to search using keywords that are found on your site. However, what if you want a specific page to display when a related keyword is used to Search but that keyword is not used on a page within the site? You can add a hidden field to any Content Type and expose that field only in the Search Results and Search Index View Modes. This will allow you to add terms that are not part of a page but related to the content to ensure that page displays in the search results if the keyword is used in the search.
View Modes is a Drupal Core feature that allows you to control what is seen or utilized on a page display based on the context in which it is viewed – i.e. full pages or teasers. Additional View Modes are available based on the Modules you have enabled.
The following lists the View Modes that are available as part of Drupal Core:
In this tutorial we will focus on the Search Index and Search Result View Modes to optimize the search results for your site using the Search and Custom Search Modules.
The first step to optimizing your search results is to create a Keywords field. Here you will place words that describe and give information about other data but are not found within that specific page.
Configuring View Modes is fairly straightforward regardless of the Module enabled. View Modes can be found as part of the structure of a Content Type in the Vertical Tile labeled Custom Display Settings.
Click on the Search Index and Search Result check boxes and save the configuration. You will notice new tabs at the top of your Manage Display configuration page.
Click on each tab and drag the fields that you do not want in to search to the Hidden section. In this example, we will only display the Body and Keywords field, all the others are in the Hidden section. Save the configuration.
Do the same for the Search Results View Mode.
The site will need to be re-indexed in order for the search results to display. This happens automatically overnight but may take more than one night depending on the size of your site.