Bolster your WordPress Search with Relevanssi

Magnifying Glass

I was recently working on a site for a client (yes, I build websites too) and one aspect of the website included the ability to use the site’s search function to search for a competitor’s product code and have the site display the equivalent product offered by my client.

In order to implement this function, I decided to insert the competitor’s codes as custom fields to each product’s post. However, therein lay a problem; WordPress’ search function doesn’t search custom fields in posts.

In fact, this is just one of a whole host of restrictions in the WordPress search function. Here’s a few more:

  • Results displayed by newest first, rather than best match.
  • Cannot search comments, categories, tags, shortcode content or excerpts.
  • Cannot highlight the search term for easy recognition.
  • Corrections to spelling mistakes not offered (did you mean…?).
  • Restrict specific pages, posts or categories from appearing in results.
  • Track search queries for better understanding of user behaviour.
  • Cache search results for improved performance.

In fact, I’m surprised that a revamp of the WordPress search has not been included recent development cycles. Maybe it will be included for WordPress 3.4…?

At any rate, despite WordPress’ shortcomings, there is an excellent plugin that will help solve most of your gripes with the standard WordPress search function.

Relevanssi‘s motto is “WordPress Search Done Right” and they mean it too. There’s more features than you can shake a stick at, which makes this comprehensive plugin the perfect candidate for anyone who wants or needs a little more than WordPress’ bare bones search gives you.

The out-of-the-box setup is pretty decent, touting features like using the AND operator as stand (must match all search terms), but falling back to the OR operator (match any term) if there are no results using the AND operator.

Among the other features are the ability to restrict searches to certain categories or tags (or exclude certain ones instead), custom excerpts in your search results (length of snippet set by you), highlighting the search term in search results and even the entire post, once it’s opened from the search results and a user-defined set of stopwords (words to ignore when searched for).

Whatever reason you’re looking for a little more from the WordPress search function, chances are that Relevanssi has the answer you’re looking for. They also have a premium edition, which includes even more specialised options. Check out the feature comparison here.

Have you ever felt hampered by the standard WordPress search? Do you agree that it’s about time for an upgrade? What feature would you like to see included?

12 thoughts on “Bolster your WordPress Search with Relevanssi”

  1. Richard says:

    I use relevanssi for the search engine on my blog. It is definitely a head and shoulder above the default wordpress search engine. I would recommend upgrading from the default wordpress search to this if you can.

    1. Hi Richard,

      Yes, the benefits it brings are excellent when compared to the paltry standard WordPress offering. It’s well worth installing on any blog, regardless of your search needs.

  2. Brian H. says:

    I tried Relevanssi once. I deleted it soon after installing it. I can’t even remember which of my websites I used it on, but it just didn’t meet my expectations. But, I’m still not completely happy with WP search.

    1. Hi Brian,

      Do you recall what it was that you weren’t happy with? There’s other search plugins that can improve the WordPress search if you’re not happy with it; Relevanssi is just the one I chose because it had the best results for me on that client’s site that I was building.

  3. Steven says:

    I wasn’t sure about Relevanssi’s before especially after hearing comments about its usefulness. I tried it and in time I was able to appreciate its features. I am always open to improvements in my wordpress. I am glad I made the decision of applying Relevanssi.

  4. John says:

    Thanks for this post, I may well try this. You are exactly right about how lame WordPress search is. I do try to limit my use of plugins to a very few. The biggest reason for this is performance – plugins often are resource hogs. But there is also the issue of security (just adding more plugins increases the odds of one you include having some security problem).

    1. Yes, keeping down the number of plugins is generally a good idea, but with the WordPress search being as lame as it is, it’s certainly a worthy addition.

  5. Anna says:

    I like WordPress pluggins a lot, but I wasn’t familiar with Relevanssi. I will try it and I am sure that it will hep my blog:) thanks

  6. Terrific plugin. As usual, Dave, your site is the real deal.
    Installed and configured, but can’t get my photos to come up with the results list. They do show up when the article title is clicked. Yes, checked “Index and search your posts’ attachments” (which include photos). Tried setting with custom excerpts/snippets on and off. Cleared cache. No dice. Any advice?

    1. Do you mean to say that you want the featured thumbnail to show up in the search results? If so, it sounds like you need to edit search.php to include the post thumbnails in the results. Indexing the images and attachments will not include them in the search results (it will just pull their alt and title tags into the search index to be matched).

  7. Thanks, Dave. Will give that a try. It’s a pretty great search engine even without the photos!

  8. This may be included within relevanssi but I’ve hooked into bing’s API to enhance the search results page on my blog with Google style ‘did you mean’ on my no results page to correct spelling mistakes. That page is a great place to restyle and suggest related or popular content.

Leave a Reply