Development Drupal

Drupal Search API — search that actually works

🎧 Listen to every article back to back

Search is often the most-used feature of a site — and the most often done poorly. Here is how to set it up properly in Drupal.

Drupal Core includes a basic search function built on MySQL full-text search. This works for a few hundred pages. But when a site has thousands of content items, multilingual content, complex filters and autocomplete suggestions — a different solution is needed.

Search API module

Search API (opens in a new tab) is Drupal's de facto standard for advanced search. It decouples the search index from the database and allows using external search engines.

Search API provides:

  • Indexing — define which content types and fields are indexed
  • Server abstraction — the same configuration works with Solr, Elasticsearch or database search
  • Views integration — search results displayed via Drupal Views, with filters and sorting
  • Facets supportsearch_api_solr with the facets module delivers filtered category search

Apache Solr

Apache Solr (opens in a new tab) is a Java-based search server with the closest Drupal integration.

When to use Solr:

  • Large content volume (10,000+ documents)
  • Multilingual search with language-specific stemming
  • Complex faceted search (filters, ranges, relevance tuning)
  • Fast autocomplete suggestions

The official search_api_solr module handles indexing, queries and language stemming automatically.

Elasticsearch

Elasticsearch (opens in a new tab) is an alternative to Solr — more powerful for real-time search and large-scale data analysis.

When to use Elasticsearch:

  • Real-time search (logs, events, dynamic content)
  • Geographic queries (nearby locations)
  • Complex data analytics and aggregations

Drupal has an elasticsearch_connector module, though it is less actively maintained than the Solr integration.

Database server — the simpler option

Search API also supports using Drupal's own database as the search backend. This does not scale to thousands of documents, but for smaller sites it is a simpler solution without an external server.

Typical search requirements

NeedSolution
Simple text search, small siteSearch API + Database server
Fast search + filters, medium siteSearch API + Solr
Real-time indexes, large dataSearch API + Elasticsearch
Autocomplete suggestionsSearch API + Solr + search_api_autocomplete

If search is a critical feature of your site, the search architecture is worth designing before development starts — retrofitting it later is costly. Describe your requirements.

Kaido Toomingas, WebPro technical leadWebPro Company OÜ Technical lead: Kaido Toomingas

Need Drupal help?

If the article describes your situation, you do not have to read everything first. A real person will help you choose the next step.