Helping customers to 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 discuss how you can improve your WordPress search experience with Algolia. Additionally, we will cover a couple of technical tips and tricks to ensure everything plays together nicely.
A problem searching for a solution
The process to locate relevant information is otherwise known as the search algorithm.
The out-of-the-box algorithm used by WordPress is fairly simplistic. They calculate relevancy 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
The following 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 considered.
Spelling errors in search terms can lead to no results being found. Therefore, 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. As a result, instant search results are provided, directing customers to where they need to go faster, with less typing.
You can further refine results due to the improved results page functionality. For example, by limiting the results to products within a specific category.
The plugin handles the indexing of WordPress data. It replaces the default WordPress search algorithm and can also integrate Algolia’s Instant Search feature.
The plugin has interchangeable settings. This allows you to choose the WordPress data to send to Algolia and supports the usual pages, posts, tags and categories. It also picks up custom post types and taxonomies.
Post meta can store additional information alongside post objects. For example, a product may have a field to store its SKU. In order to search by SKU, Algolia must register and index this field.
Keeping everything in sync
The plugin monitors 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, you can automate this process.
Algolia tiers their pricing 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. As a result, if done well, it will quickly lead customers to the right product, with less typing. Hopefully we have given you a better understanding of what you can do to improve your WordPress search experience with Algolia.