Configure Algolia Search for Fast WordPress Searching

Algolia provide awesome WordPress search functionality. It is incredibly fast similar to what you get with Elasticseach though Algolia wins in benchmarks. Not everybody wants to host their own Elasticsearch cluster (read how) but they want faster WordPress search. Algolia is the answer for a hands-off solution.

Algolia’s free hacker plan allows up to 10,000 records. For reference I had about 25 rather long posts between 500-1000 words when I tested Algolia and it took up 1784 records. Records consumed depend on the length of your posts. In general Algolia estimate that your records will be 15x your number of posts. This should give you an idea if you will be able to stay on the free plan or move to the starter plan ($49) which gets you 100,000 records.

Configure Algolia Search for Fast WordPress Searching

Sign up for a free hacker account from Algolia

algolia-sign-up

After you sign in to Algolia you will get a welcome screen.

Algolia has a lot of developer friendly features, the WordPress plugin will take care of creating indices so you can click Skip tutorial unless you want to explore everything you can do with Algolia.

algolia-search-wordpress-fast-skip-tutorial

We need to get the API information for the Algolia WordPress plugin since that is how our WordPress posts and pages will be sent to Algolia’s indices.

Click API keys in the sidebar.

You will need all of this information for the WordPress plugin so stash this for now.

The small copy icon can be used to easily copy these to the clipboard in a few minutes when you use them in the plugin.

find-algolia-api-keys

Configure Algolia Search for WordPress Plugin

The Algolia WordPress plugin is in the repository so you can install and activate it from your WordPress Plugins wp-admin area.

Upon activation you may see this error:

Algolia Search requires the “mbstring” PHP extension to be enabled. Please contact your hosting provider.

algolia-mbstring-warning

For PHP7 you can solve the mbstring error by installing this package

sudo apt-get install php7.0-mbstring

For PHP5 you can fix the mbstring error by installing this package

sudo apt-get install php5-mbstring

Click Algolia Search in the Admin sidebar and then its submenu Settings

Add your API keys here from the Algolia API Settings page shown previously.

Click Save Changes.

algolia-search-api-settings-wordpress

Pick the Indices you would like to index. They are based on the WordPress MySQL tables.

Click Save Changes.

algolia-index-content-wordpress

After you save the task will start indexing your posts and pages.

algolia-index-content-done-wordpress

On the search settings you can choose how to use Algolia.

There are various options, by default Do not use Algolia is enabled which means exactly what it says.

Use Algolia in the backend means you will use Algolia’s indices when searching WordPress.

Use Algolia with Instantsearch.js will enable the Instant search and autocomplete.

Click Save Changes.

algolia-search-settings-wordpress

If you want to use Autocomplete you will need to go to Algolia > Autocomplete and choose which post types you want autocomplete.

algolia-search-wordpress-autocomplete-settings

All that is left now is to monitor Algolia using its beautiful dashboard.

Monitor Algolia

Log in to Algolia and click Dashboard and choose your App. You will see a nice overview of search performance.

algolia-dashboard-performance

If you click Indices you will be able to see how Algolia is indexing your posts and pages.

algolia-show-indices-dashboard

Enjoy your new faster WordPress search with Algolia.