Fast and convenient Solr search for Drupal 8 with Search API
How did people live without the opportunity to search online?
It’s hard to believe now this was the case before the 1990’s! And what a joy it is to know that absolutely any website today can serve as a kind of little “Google of its own” by providing a user-friendly search. This is thanks to several great technologies, one of which is Apache Solr. In this article, we will focus specifically on using the Solr search on Drupal 8 websites. It’s one of our series of posts about Drupal 8 which already include configuration management, AMP implementation, link-creating tools, accessibility improvements, modules such as the Paragraphs, the Media Entity, the Honeypot in Drupal 8 and much more.
Solr and Drupal: they found each other!
Apache Solr, a blazing, versatile and reliable search platform, has always been a great solution for creating fast and user-friendly search interfaces on Drupal websites.
Solr are Drupal are both open-source projects with big and friendly communities, both are powerful, flexible and highly scalable, both can handle high-traffic website and applications. They are clearly a great for match for each other!
Among the things that Apache Solr search can provide for Drupal websites are fuzzy searches (allowing for spelling mistakes), refined/faceted searches, rich-text snippets (text snippets with search queries highlighted), search suggestions (“did you mean”), and more.
In addition, Solr search works a great deal faster than a traditional search, does not overload the database server, and gives you great flexibility in making the search settings.
Search API: the “sole provider” of Solr in Drupal 8
Of course, for implementing Solr search on Drupal websites, you do not need to start from scratch. The Drupal community provides useful modules that can make your work a lot easier.
In Drupal 7, there were two major modules responsible for Solr search: the Apache Solr Search and the Search API, each of which had a different architecture, but served basically the same purposes, which required duplicate efforts for handling various issues.
So, at DrupalCon Prague, a decision was made so all the functionality was united in the Search API. Then the great mission began for Thomas Seidl and Nick Veenhof and the team.
According to Nick, Drupal 8 helped them rethink certain concepts and eliminate the divide between the Apache Solr Search and Search API that existed in Drupal 7. “Search API will be the sole provider of Apache Solr integration in Drupal 8,” he said. Thanks to tireless drupalers, this came true!
The process of making Search API a powerful and highly customizable Solr search tool in Drupal 8 included the porting of a whole ecosystem of useful modules: search_api_solr, search_api_multilingual, facets (formerly known as Facet API) and more. It also involved big improvements like adding multilingual support, enhancing the flexibility in data display, make pages load faster etc.
The Search API’s three concepts
Here is a great explanation given Joris Vercammen in his speech at DrupalCon Dublin about the three concepts that the Search API consists of:
- Search index (what we are going to search for: nodes, users, taxonomy, etc.)
- Search server (the place where the data is stored: MySQL, Solr, ElasticSearch, etc.)
- Search display (the way the data is going to be displayed on your website)
The Search API is a high-class search toolset, and to unlock its full potential, you can entrust every aspect of its proper configuration to our Drupal experts. So, if you are interested in using Solr on your Drupal 8 but need help in it, search no more — you have found reliable assistants here!