How does the Drupal search engine work?

Written by Mark Enrega on Tuesday, February 19, 2019

Drupal has a powerful search engine built within its content management system. It lets users search for specific content on your website and it can be used to search for both users and particular words, depending on how it has been configured on your website. Typically, the search module is used to put a search box on all pages of your website so users can find content from any page on your website. This article explains how the search module works and how your content gets indexed within the search engine.

Indexing your content for search

Drupal's search engine indexes the text content of nodes (pages) within your website. It does this at regular intervals when Drupal runs its "cron jobs" and they can run weekly, daily, hourly, or whatever you like. For a modest personal site to which you post now and then, you might set up such a cron job to run once a day. For a more active site you'd likely want to run that job more often, perhaps every few hours or every hour.  When you are logged in to your website as a Super User, you can see the cron settings of your website in the following section your admin pages:

Configuration > System > Cron

When you create, edit or delete content, it will be marked for re-indexing and the content will be indexed when the next cron job is run. When you are logged in to your website as a Super User, you can see the progress of the indexing process in the following section your admin pages:

Configuration > Search and Metadata > Search pages

WARNING: It is not recommended that you alter any of the settings on these pages and you should never re-index all your content unless there is something very wrong. Please consult with our support team before making any changes.

Quality of your content for search

When creating new content for your website, it is best practice to write your content using the keywords that people will typically use when trying to find content. If you do this right, then they'll find links to your content when they use keywords while searching. This is beneficial for both Drupal's search engine and external search engines, like Google or Bing. Pages with a low volume of content will get ignored by search engines, so it is always best to use our SEO recommendations when creating content.