Reader small image

You're reading from  Drupal 10 Masterclass

Product typeBook
Published inDec 2023
PublisherPackt
ISBN-139781837633104
Edition1st Edition
Tools
Concepts
Right arrow
Author (1)
Adam Bergstein
Adam Bergstein
author image
Adam Bergstein

Adam Bergstein is a product engineering leader and an architect. He has been a long-time Drupal community member, a routine speaker at Drupal community events around the globe, and provided keynotes for several events. He has maintained and contributed to many Drupal projects, including Password Policy, Taxonomy Menu, and more. Adam is the lead of Simplytest, a free service, and a project that offers Drupal community members testing sandboxes. He has also worked for both agencies building Drupal applications and Drupal service providers building Drupal-related products. He has led the Drupal Community Governance Task Force and is serving a term as a community board member of the Drupal Association.
Read more about Adam Bergstein

Right arrow

About the feature

Content management systems, especially those with a large amount of content, practically require that content to be searchable. Search engines such as Google have made search features ubiquitous, as users expect to find what they want and need as quickly as possible. Drupal is built to manage content and is capable of managing content at scale. As such, the search function is a widely used and popular feature that is built into the Drupal core and is highly extensible. Next, we explore how search capabilities are built into Drupal.

Implementation

The search function is a specific feature built on top of existing content entities. Other systems introduce their entity types, but the functionality provided by the search function is only designed for the existing content-related entity types. This feature is provided by the Search module in Drupal core.

Implementing a search function requires an index for storage. At a high level, this can be considered a mapping...

Use cases

Search in Drupal helps both users and site builders create capabilities in applications to find content.

Querying for two different movie titles simultaneously

Drupal’s native search form, which invokes Drupal’s search processor, supports various search parameters. In the search form, the following can be entered:

"Wizard of Oz" OR "Gone with the wind"

And, don’t forget, Drupal does offer some advanced search options that can abstract Drupal’s native search form.

Filter by sport

This use case is perfect for the Facets module. After enabling facets, which also enables Search API, facets can be created through Search API’s configuration (admin/config/search/search-api). Specific field-type widgets can be implemented through search API processors, specifically a preprocess query processor. Then, leveraging the advanced settings of the search page configuration, the processor can be added and the facets can...

Summary

This chapter highlighted both out-of-the-box and extended search features. Configuring search pages and the search form block allows site builders to build search functions into their applications without writing code. Concepts such as indexing were covered both within Drupal and by leveraging popular third-party indexes, such as Apache SOLR. Configuring advanced features, such as facets and autocomplete, can provide additional experiences that can be useful on a case-by-case basis.

The next chapter discusses contact forms in Drupal, which is a feature for user engagement. Contact forms provide a means for users to fill out a form on the Drupal application and reach administrators.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Drupal 10 Masterclass
Published in: Dec 2023Publisher: PacktISBN-13: 9781837633104
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Adam Bergstein

Adam Bergstein is a product engineering leader and an architect. He has been a long-time Drupal community member, a routine speaker at Drupal community events around the globe, and provided keynotes for several events. He has maintained and contributed to many Drupal projects, including Password Policy, Taxonomy Menu, and more. Adam is the lead of Simplytest, a free service, and a project that offers Drupal community members testing sandboxes. He has also worked for both agencies building Drupal applications and Drupal service providers building Drupal-related products. He has led the Drupal Community Governance Task Force and is serving a term as a community board member of the Drupal Association.
Read more about Adam Bergstein