Strattic Developer Docs

Search on Strattic

You may have noticed that search doesn’t work the same way on Strattic that you might expect on a typical WordPress site. That’s to be expected, native WordPress search requires a server, and remember, with your live site on Strattic, there is no server 🧙‍♀️ ✨.

This is the gist of how we’ve implemented search for Strattic sites.

Overview

Strattic search hooks into and replaces the native WP search with Algolia, a static search solution that is very fast and powerful for searches.

Whereas native WP search appends ?s=english to the end of a slug to perform a search, Strattic assigns a search page, and displays the results there, appending a query param as well. For example, a URL for the page for your site with Strattic Search enabled might look like: https://developers.strattic.com/search/?q=search.

We use Algolia to index the search results from a site, and it will return properties like:

  • Content
  • Slug
  • Taxonomy
  • ID
  • Author
  • Etc.

Note: we can add any other data we want, including data that can be used by Mustache.js to render templates with conditionals.

When a site is published, we collect all the data of all the posts and send it to Algolia. We check for changed data, remove deleted data, update changes, add new data, etc.

Digging in…

So, you’re probably wondering how you can customize your search data and results page to your liking, right?

Of course you are! That’s why you’re here! 🤓

If you’re looking to custom your search results page, check our documentation on Customizing Search Results, Templates, and Tags.

If you want to customize what Algolia stores and returns, please see our documentation on Customizing Algolia Search Results.

Questions?

Obviously, we can’t reveal everything 😃, but if you do have any questions, please don’t hesitate to reach out to us!