Skip to content

Latest commit

 

History

History
33 lines (18 loc) · 2.18 KB

exercise-9-1-explore-the-default-search.md

File metadata and controls

33 lines (18 loc) · 2.18 KB

Exercise 9.1: Explore the default search

First, let’s see how the default search works.

Default search results

Your website should have a search block in the header or footer. If not you can add a Search block by going to StructureBlock Layout and clicking Place Block in the region you wish to add Search. Then search for 'Search'.

Image of Add Search block to Footer Top

The screenshot below shows what a default search result may look like. By default, the search will only find full words (so a search for “class” won't find “classroom”).

You can control this in StructureContent types → (choose a content type) → Manage display. In this screen you can configure the view mode and field display for Search results.

Image of Manage Display - Search

Image of Manage Display - Search - Fields

Note that in the given example for the Standard Page content type, we use view mode Search and Search layout, to stay consistent with other content types in GovCMS. The view mode used in the search could be any other one available, as long as it’s configured to display in the search results (we’ll explore this later).

Image of Search page

Understanding the index

  1. Add a new News and Media with a word you haven’t used before, such as “basketball”.
  2. Once you’ve published the content, do a search for the word. You won’t get any results because the search doesn’t update instantly. This is because the search uses a cached index of content to speed up the results and decrease the performance impact on your website. However, the search will be updated the next time the cron job is run.
  3. Try the search in a few minutes. Note: The search is case-sensitive.

What is cron?

Cron is a method for scheduling specific tasks to run on your site. Cron is scheduled to run every three hours by default and clears the site cache when you run it. You can schedule tasks using cron as often as you’d like.

Read more http://drupal.org/cron