Helping customers find things quickly reduces frustration and can lead to higher sales. The search functionality provided out-of-the-box by WordPress is at best considered basic. With customer expectations set by the likes of Google and Amazon, how can we improve the often overlooked on-site search experience?
If like us, you’re looking to improve the user experience of your website, follow along as we introduce one of our preferred search solutions and cover a couple of technical tips and tricks to ensure everything plays together nicely.
A problem searching for a solution
The process taken to locate relevant information is known as the search algorithm.
The out-of-the-box algorithm used by WordPress is fairly simplistic. Relevance is determined by looking for a full sentence match and then for results containing each word individually. The algorithm only looks across two fields, the title and content.
We’ve worked with a number of search solutions over the years, from WordPress plugins to Solr and Elasticsearch. We’ve recently been integrating with hosted solutions, one such solution being Algolia.
The benefits of using Algolia
Here are a few of the improvements we can expect from switching to an Algolia powered search solution:
- WordPress sites often store information outside of the post title and content. The two most common places being post meta and taxonomy terms. Algolia can see the whole picture. Using Algolia will ensure other fields are taken into account.
- Search terms can contain misspellings which could lead to no results being returned. Algolia can automatically correct common typos or offer suggestions.
- Language quirks also play a crucial role in returning useful results. Algolia understands that multiple words can share the same meaning, for example, sofa, couch and settee.
- Algolia provides a find as you type interface. Providing instant search results, directing customers to where they need to go faster, with less typing.
- Improved results page functionality allows results to be further refined. For example, by limiting the results to products within a specific category.
WordPress and Algolia
The integration of Algolia within WordPress is made easier thanks to the WP Search with Algolia plugin.
The plugin handles the indexing of WordPress data. It replaces the default WordPress search algorithm and can also integrate Algolia’s InstantSearch feature.
The plugin has a settings page which allows you to choose the WordPress data to send to Algolia and supports the usual pages and posts, tags and categories. It also picks up custom post types and taxonomies.
Post meta can be used to store additional information alongside post objects. For example, a product may have a field to store its SKU. In order to search by SKU, this field must be registered and indexed by Algolia.
Keeping everything in sync
The plugin monitors for content changes by hooking into WordPress. Saving a page triggers a reindex of that item. Deleting a page will remove the item from Algolia.
Algolia’s index can occasionally get out of sync which can lead to less relevant or missing results. The interface allows us to manually reindex. However, this process can be automated.
Algolia pricing is tiered based on the number of indexing operations as well as total record count. As such we want to keep the number of indexing operations in check.
To automate the reindexing, we’re going to make use of the WP-CLI commands provided by the plugin. Using a cron job, we can schedule a periodic reindex.
To avoid burning through indexing operations, we build a sensible cron expression. Our clients typically follow office hours so we run our indexing operations weekdays at 6pm.
Wrapping it up
Search is an often overlooked aspect of an overall website that contributes to a better user experience. Done well, it can lead customers to the right product, in less time, with less typing.
Speak with us today to find out how we can help deliver a delightful search experience for your WordPress website project.