If you have, say, 20 posts/pages on your WordPress site, the search functionality that is baked right into your self-hosted WordPress site will probably do a great job. Search is a pretty cool feature to ship with WordPress, truth be told. But as a site grows, you'll find limits. How it works behind the scenes is a touch over my head, but as I understand it, it does a
MySQL LIKE query on your post titles and post content. It tries its best to order by relevance (like if it finds an exact sentence match), then largely orders by date.
If search is super important to your site (here on CSS-Tricks, on-site search gets used a ton) you'll probably look for other options.
TLDR: Jetpack Search is quite good out of the box, customizable, and requires very little effort.
A quick jaunt through a decade-long journey.
I started with Google Site Search, which ultimately became Google Custom Search Engine. No bones about it, Google does incredible search results, and you can focus that lens directly on your own site. There is a catch here though. You're either going to have a bunch of ads in your search results, or you'll have to use the JSON API at a cost of $5 per 1,000 queries capped at 10k/day.
I'm all about paying a reasonable amount of money for quality search, so I tried Algolia for a while, as they have a WordPress plugin. I found it quite nice, but I couldn't quite get the search results as good as I liked. Nothing against Algoia here, it's quite an amazing product (we use it on CodePen for some stuff), but it wasn't a perfect fit for this site's blog search for me.
I considered trying out some similarly hardcore options like Amazon Cloudsearch (which also has a plugin) or even spinning up a Solr instance (same). But I was nervous about the technical debt. I've learned over the years that the solutions that I like and will last are the ones with the least maintenance and least work to get going.
I was pretty stoked when...
- It's a feature of Jetpack, which I already have installed and working.
- It's extremely little work to use. I pretty much just turned it on.
- It has good search results right out of the box.
- The little work there was included:
- Dropping in the widget.
- Tweaking the algorithm to provide even better results.
- There is no load on my server.
- I have total control over the design. It's a WordPress theme
search.phppage like any other.
Another killer feature here is being able to offer filters on the original search to users. This uses any taxonomy, most likely the built-in categories and tags that many sites already have:
Here on CSS-Tricks, I could, say, search for "grid" then further refine it to content that we've specifically tagged "css grid."
WP Tavern said it well
The Jetpack Professional plan’s $299/year price point is highly competitive for access to a hosted Elasticsearch engine. Ordinarily, developers looking for the most economical way to implement Elasticsearch on a WordPress site will have to host and manage their own instances on Amazon AWS or other cloud services. This often comes with more ongoing maintenance and setup.
What I like most about powering my search this way is that it feels like The WordPress Way.
It feels like it will be supported forever. Plus, I'll have a support network for any issues and it will improve over time. There is little technical debt here, and in fact, I've reduced technical debt because of it. It's similar to what it felt like when I made a similar decision to use WooCommerce to sell things, bringing eCommerce under the WordPress roof, or when I moved our forums from other software to bbPress.