Significantly Improve the Search Speed of Drupal 9 & 10
If you use the default search function, which is available in Drupal core, while the number of published articles on your Drupal sites increases, you will notice a slower search function. In some cases, it may take more than 15 seconds for Drupal to return search results. It has a reason.
By default, the Drupal search module offers full-text indexing. It indexes all the text within your articles and contents and, in addition to saving the available words in an article, it saves the position of the words as well, which makes it possible to search accurately within the content.
While full-text indexing and searching have many benefits, they have two flaws. First of all, it needs much more database space for saving the index and second of all, it has lower search speed in most cases unless you use third-party modules and services which provide very high-speed search functions like Search API, Solr, Elasticsearch or other alternatives.
While those kinds of modules provide very high-speed searching, they need to be configured with your server, which is not available for beginner users and requires deep knowledge of PHP, Drupal, and server configuration, or you can bypass it by paying money and using hosted search services, which are not free.
Here we are going to give you an option which is known to many Drupal users, and certainly some other users don’t know a lot about it or have not tried it to feel the difference in search speed of their Drupal site.
Introducing the Search API Module to Increase Search Speed
Search API is the best easy to use module for customizing search function of Drupal effortlessly. You can download Drupal Search API module from here.
With the help of the Search API module, you can quickly and simply create searches on any entity in Drupal. Since it comes with built-in faceting support and the option to utilize the Views module to show search results, filters, and other search-related information, it is a fantastic alternative to other search solutions for site managers.
This module is mainly used for customizing search pages. For instance, using this module, admin can let users search by relevance, data or let visitors run a search consisting of all, none, or anyof the queries to get better search results based on their interest.
The only downside of the Search API module is not being able to provide full-text indexing and searching, but if you are not required to provide full-text search to your visitors, this module is the way to go.
The Experiment With Search API Module
An experiment has been done to test the efficacy of this module in improving the search speed of Drupal sites. The full content of 150 books with an average page number of 372 has been copied as the content of articles and it has been indexed using the Search API module.
Before installing the Search API module, the search took about 9 seconds for each query, and after installing the Search API module, this time has decreased to less than 1 second.
In the following photo, you can see the number of rows in the index of the Search API database. The number of rows is about 2,088,000 and the total space this index has taken is under 300 MB, which is one of the results of proving a faster search function.
Although the provided statistics are not 100% accurate and can be different on different servers and websites with different numbers of articles, this module can hugely increase the search speed of any Drupal website that needs a faster search function without going through the difficulties of installing and comigrating superior modules like Search API Solr and similar alternatives.