Igor Barato 20 Jul, 2021
Improving Drupal Search with Apache Solr

When we think about user experience, there are two ways for users to find your content: navigation or search. Navigation is totally connected with the website design and architecture, but search is very important too, and depending on the website size, it’s crucial for delivering a good experience.

The Search tool from Drupal core delivers an out-of-the-box solution to put a good search tool on your website including: a search bar and page, conditional queries (AND, OR, Exclusionary), and an index engine directly on Drupal.
 

Drupal with Database Search

 

Why use Apache Solr?

Drupal core’s solution primarily accommodates basic search solutions, it requires expensive server resources when dealing with extremely large databases. Then we need to think about other solutions when we need a robust search tool for applications with massive content.

“Solr is the popular, blazing-fast, open source enterprise search platform built on Apache Lucene”

https://solr.apache.org/

Apache Solr is an application built with Lucene indexer, which is a high-performance, full-featured text search engine library providing flexible content indexation with powerful, accurate and efficient Search Algorithms. So when we integrate your Drupal application with Apache Solr, we are improving your Drupal site's performance by eliminating costly full-text queries and providing support for other advanced features in your application, such as:

  • Full-text Search
  • Faceted Navigation
  • Related Search or Recommendation
  • Spell Suggest or Auto-Complete
  • Custom Document Ranking
  • Snippet Generation or Search Highlights
  • Powerful query types: phrase queries, wildcard queries, proximity queries and range queries.
  • And More!

The other point is that Apache Solr is totally integrated with the most commonly used Drupal hosts, which are Pantheon and Acquia. Or, you can choose a SaaS like the one we use at Twel, which is Open Solr (https://opensolr.com/)
 

Drupal with SOLR Search

 

What do we need to use Apache Solr search?

To architect and design a consistent search for your website, Drupal Search API was developed to help you deal with it. The module page description says: 

"This module provides a framework for easily creating searches on any entity known to Drupal”

With the Search API, we can model a strong search engine for your website directly on the interface, and provide a server backend integration (like Apache Solr) to create a powerful and flexible solution.

Furthermore the Drupal Search API delivers a lot of additional modules to enhance usability:

  • Autocomplete
  • Synonym
  • Faceted Search Interfaces
  • Highlighting
  • More Like This
  • Spellcheck

If your organization is in need of a more robust Search engine on your website, let's connect and we’ll be happy to assist you in the process.


References:
- Why use Apache Solr with Drupal? (https://drupalize.me/videos/why-use-apache-solr-drupal?p=2132)
- Apache Solr (https://solr.apache.org/)
​​- Search API 8.x+ Documentation (https://www.drupal.org/docs/contributed-modules/search-api)
- HowTo: Use Apache Solr with Drupal 8 (https://opensenselabs.com/blog/tech/use-apache-solr-drupal-8)

​​​​​