White Label Coders  /  Blog  /  Algolia. Modern alternative to WordPress search

Category: E-Commerce / WooCommerce / WordPress

Algolia. Modern alternative to WordPress search

WordPress and Algolia modern search
4 min read

WordPress built in search system

When it comes to WordPress search, both developers and users are not big fans of the built-in search system. The former finds it hard to customize and make it suitable for their specific needs, whilst the latter tend to complain about overall slow performance when searching for specific word, especially when the number of posts present in the database is large.

Unfortunately, WordPress search is slow by its nature since it can only use SQL queries and it is not designed for full-text searches.

Search customization

On top of this, the built-in search system is very limited from a functional point of view. It just literally searches in the database and returns results, adding anything other than this to your site, for example filtering system, which requires extra development effort. WordPress offers some hooks which let you modify the default search query. It also gives you control over basic parameters such as post type in which you want to search etc.

Fortunately, as usually in WordPress, we can make use of one of many WordPress plugins out there. These customize default WordPress search behaviour, make it configurable and make search results more relevant. Some of the plugin incorporate AJAX which improves user experience to some extent and boost perception of speed, as page reload is no longer the case. With the aim of custom code and search plugins you can make more out of WordPress search.

You will hit the limit

For small brochure sites, when you need to help your users navigate through a dozen or so pages, the built-in search system is enough.

At a certain point though, WordPress search plugins and your MySQL database will not be able to handle it anymore. Remember that the bigger your database is, the more time it will take to execute your search queries. With tens of thousands of posts or products in the database, it is a matter of time when your client or your users will start complaining that search is not good enough and you need to do better. It is not surprising, as with such a high volume of content in database, the importance of well performing search is much bigger.

What then?

When you need more than MySQL powered search. You should start looking for alternative search engines known for their speed, scalability, and stability. One of the most well-known alternatives is “Elasticsearch”, a service from AWS. You can integrate it with WordPress thanks to the “Elasticpress” plugin. I used to work with “Elasticpress” on a few occasions and I found it pretty hard to customize. Especially when a client required to customize a relevance algorithm, which isn’t something that can be controlled in the plugin settings page. Using this stack also involves certain amount of DevOps work which can sometimes be a challenge as well.

During one of my recent projects, I had an opportunity to work with just another alternative search engine that you can integrate with WordPress. This was a huge and astonishing discovery!

Search with Algolia

“Algolia” is a powerful, hosted search API that helps to create fast and relevant search experiences in your application. When it comes to WordPress, it can be integrated with your sites by using a plugin called “WP Search with Algolia”. Indexing your content is fast and easy (an index is the place where the data used by a search engine is stored). However, might require some preparation work, e.g., you might want to just synchronize specific post types. Plugin comes with a bunch of hooks which are there to make this happen.

When it comes to mentioned project, main assumptions of the project were as follows:

  • it must work in WordPress multisite install (separate content indexes for each site)
  • support for auto-complete feature (also known as auto-suggest)
  • instant search experience (search results should reload as you type in)
  • searching two independent sources of data at the same time (federated search)
  • filtering by various taxonomies
  • sort by date (and date ranges), relevance, alphabetically
  • support for pagination and infinite scroll
  • support for highlighting
  • full control over feel & look
  • admin should be able to manage relevance and other settings in Algolia dashboard (rather than let the controll be in WordPress or within code)

Plugin “WP Search with Algolia” offers two modes: Use of Algolia in backend and use of Algolia with InstantSearch.js. The latter option is where all the magic happens, and it allows to achieve all the goals outlined above.

InstantSearch.js is an open-source UI library for Vanilla JavaScript. It lets you quickly build a search interface in your front-end application. An important part of this goal is achieved by providing front-end widgets that you can assemble into unique search interfaces. “WP Search with Algolia” provides templates which can be overwritten in your theme and will be the base for further development work. Ultimately, the JavaScript application will replace the body of your WordPress search page, providing an extremely fast (most of search queries take from 1 to 20 milliseconds to process) and highly configurable search interface.

Apart from all mentioned features, Algolia offers much more. One of the things I like a lot about Algolia is that you can manage all these amazing and robust features within the Algolia dashboard.

Other features worth mentioning are:

  • Analytic tools to understand your user behaviour
  • A/B testing
  • Custom ranking which helps in building your own search algorithm
  • Synonyms support and dynamic synonyms suggestion
  • Users’ personalization
  • It is language-agnostic

Live demo together with some code samples of the search application built with Algolia and InstantSearch.js can be seen here.

WordPress and Algolia summary

When it comes to fast and reliable search solution for your WordPress site, Algolia is the software that I would highly recommend. Building a search interface with InstantSearch.js is relatively simple. However it requires a skilled JavaScript developer though. It is pretty fast and the final user experience is just amazing.


WordPress Developer / Team Leader

Highly experienced professional in front-end and WordPress web development. His competences include building web applications, websites, integrations, strengths such as business analysis. His interpersonal skills led him to be involved in project management. Marcin has very good command of English and many years of experience working in the international environment.

Related Articles
Check related articles
Prestashop vs WooCommerce
The battle of e-commerce platforms - Prestashop versus WordPress

With the rapid pace of digitalization and ever-changing customer expectations, our digital “be-or-not-to-be” starts at very basics: our website. Without a website, your business is not on the digital map, and you lose potential clients to your competition.

Read more
Project backlog optimization
How to optimize project backlog. The benefits of backlog refinement.

In the world of project management, using Backlog Management is an efficient way to organize and prioritize your software team’s tasks.

Read more
WordPress issues
How to troubleshoot WordPress issues?

Undoubtedly, WordPress is one of the most popular platforms for creating a website. But  even it can sometimes cause problems. Just like any other software.

Read more
my wordpress webiste got hacked
My WordPress website has been hacked. What should I do?

Any WordPress website could be hacked, and when it happens, you may be tempted to panic. Don't. Calm down and just read how to ...

Read more
WLC ACF Post Save Helper WordPress plugin
[Plugin] WLC ACF Post Save Helper

Read more
delighted programmer with glasses using computer
Let’s talk about your WordPress project!

Do you have an exciting strategic project coming up that you would like to talk about?