Google Programmable Search Engine
In a default installation, a site will be set up to use Google Programmable Search Engine (PSE, formerly Custom Search Engine). This relies on Google to do the heavy lifting of search indexing & relevance. You define what pages should be indexed and Google returns results for only those pages. Visitors will view the Google search results from within your site. Read an overview of how CSE works.
Google PSE is integrated into your site using the :ref:`Google PSE module <https://www.drupal.org/project/google_cse>`_. It leverages the Drupal interface for defining where the search box should show up and how that search box should look. Practically speaking, this means that switching a site to a different option should require minimal or no cosmetic changes.
Important
The following assumes you’ve visited Google’s Programmable Search Help pages and control panel and have done the following:
setup the domains or websites you’d like to use search for, or wish to exclude from Programmable Search from
obtained a Google Programmable Search ID
If you haven’t, be sure to read Google’s documentation.
Configure Google Programmable Search in a site
Add the ID to a site
Navigate to Configuration > Search (/admin/config/search/pages) and click the “Edit” button at the bottom of the page for the Google CSE search option. At the top of the configuration page, replace the default ID with the ID you got from Google. Complete the other configuration options as desired.
Sites usually will not need other Drupal core search pages enabled. For more detail, see https://www.drupal.org/docs/8/core/modules/search/overview
Remove search altogether
Some sites may not want or need site search. Removing it is a two-step process.
Remove the “Search form” block from the “Header Tertiary” region on the site’s block configuration page by going to Structure > Block layout (
admin/structure/block).Proceed to uninstall the Google CSE module and the core “Search” module at Extend > Uninstall (
/admin/modules/uninstall).
Alternative: use Drupal search
Drupal provides its own search engine, which may be preferable to using Google CSE in situations like the following:
A site has content that is available only to authenticated users, and you want those users to see that content in a site search.
You want to curate search results in a more granular fashion – say, providing one search for certain types of content and another search for user profiles
You want to provide a search interface that allows filtering results by custom-defined categories (also referred to as faceted search)
If you want to use Drupal search instead of Google Programmable Search, switching is relatively easy. Authorized site managers can navigate to Configuration > Search (/admin/config/search/pages) and disable/delete the Google Programmable Search option and enable one or more of the other options. Read more on this.