Key Concepts

To make the most of Search Plus and Algolia, there are a few key things you need to understand about how the setup works.

Algolia handles the Searches remotely #

When a user searches the actual search request never touches your Craft install. Instead the search request is passed directly down to the Algolia search api via javascript. Subsequent filtering, faceting, pagination etc.. all follows the same flow, never touching the Craft install.

Content is organised into Indexes #

Everything you want searched needs to in an index. And index can have lots of different types of content, or just a single type. You can search multiple indexes at the same time, but ranking, sorting, filtering etc.. actions all work on a per-index level.

Algolia calls individual items objects #

In Algolia you'll see they refer to each individual item in the search indexes as objects. For our purposes, you can think of an object as directly equal to a craft element.

Just to refresh - in Craft an element can pretty much anything - be that an entry, user, tag, asset, category, or even third party elements like commerce products, commerce orders etc..

Search Plus will eventually support all native element types and allow third party elements to add their own support too. For the 1.0 launch, we only directly support Entries, but more types are coming very soon.

Content Mapping turns Craft content into something Algolia understands #

Algolia see's it's content as a schema less json blob with a few required attributes. Search Plus uses a set of content maps to turn the Elements into these json blobs.

You'll see the most basic content map is included, but third parties can extend and build their own alternative mappings too. You might want a custom mapping if you want more control over the final output, or want to do some intermediate processing on items before exposing the content to search.

Algolia will dumbly return the search result objects #

When a search returns the content back for a search result you won't have the opportunity to do any real processing or manipulation of that content.

What does that mean in practise? If you wanted to run a search that included thumbnails of assets, you need to create and pass the thumbnail details of the appropriate sizes at the point of mapping, vs. manipulating / creating the thumbnails at the point of output.

The custom mappings can be the key here if you've got custom requirements.

Search Plus will keep things in check for connected indexes #

When creating an index through Search Plus you'll be prompted to perform a first-run content population. That runs through all the content in the index set and maps each item in turn, and adds to the index. This is only something you'll need to worry about the first time.

After that, for each operation on elements - create, edit, delete - Search Plus will automatically keep the appropriate indexes updated with the latest versions.