The search box is an essential feature of any website, helping visitors to find the content they’re looking for.
Unfortunately, search remains an area where the core version of WordPress still disappoints. It only searches through the title and content of post types, and is unable to search taxonomies, custom fields or attachments — often producing irrelevant results, and frequently placing old, unrelated content at the top of a slow-loading search results page.
All of these issues can be resolved by installing Relevanssi.
In this article, I’d like to show you how you can use Relevanssi to greatly improve search on your WordPress websites.
What Does Relevanssi Offer?
The key goal of Relevanssi is to help visitors to find relevant content. It does this by allowing partial keyword matching, as well as giving the ability to search for exact phrases using quotes and showing search terms in search results. A ‘Did you mean?’ suggestion feature is available too.
Relevanssi supports all WordPress post types, but it also allows visitors to search through comments, tags, categories, custom taxonomies and custom fields. Searches can be restricted to specific categories, and Relevanssi natively supports the WordPress block editor, WordPress multisite and popular forum, and membership and language WordPress plugins.
The premium version of Relevanssi unlocks many more useful features, such as indexing of PDF documents and office attachments, spelling correction suggestions, related posts and more.
The developers state that Relevanssi may require hundreds of megabytes of space in your WordPress database to operate efficiently — noting that a reasonable estimate for storage is to multiply your website’s wp_posts database by three. They also note that Relevanssi hasn’t been optimised for WordPress websites with more than 30,000 posts to index.
In practice, I don’t believe these limitations will affect many WordPress users — the reality is that most feature-rich WordPress plugins add multiple tables to your WordPress database, which is one reason why WordPress websites that are hosted on basic shared hosting plans are usually slow.
Likewise, many WordPress users struggle to scale large WordPress websites efficiently, as they need to accommodate higher usage of disk space, database, memory and CPU resources. The only difference between Relevanssi and other WordPress plugins is that the developers have chosen to be transparent about these scaling issues.
The Free Version of Relevanssi
If you wish, you can activate Relevanssi on your website, index your content and instantly see improved search functionality on your website.
While many website owners use Relevanssi this way, my advice is to go through all of the Relevanssi settings pages so you can optimise features and options for your website.
Nine pages are available in the settings area, with two of these pages — attachments and redirects — restricted to the premium version of the plugin.
The overview page guides you through the initial steps of using Relevanssi, and, after indexing content, you’ll be advised to go to the highlights and searching and excerpts pages.
The first thing you need to do is build your search index. You can select which post types and taxonomies are indexed by Relevanssi.
There are also options to index comments, pingbacks, custom fields, author names and excerpts.
In the advanced settings area, you can define the minimum word length for words to be indexed, and also configure punctuation. For hyphens and dashes, apostrophes and quotes, ampersands and decimal separators, you can choose to keep them, remove them or replace them with spaces.
The searching settings page lets you change many aspects of searching — the default operator, for example, determines whether searches require all search terms to be met or just one of them. You can also state whether posts need to match partial words or whole words.
By default, results are ordered by relevance, but this can be changed to post date if you wish. You can also adjust how results are ranked by changing the weight of post content, titles, comments, tags and categories.
Content can be hidden from search results in a number of ways: You can restrict search results from specific categories; exclude categories and exclude specific articles using their post or page ID; and also hide custom post types by setting exclude_from_search to true.
There’s no way to restrict content by publication date, but this feature is available in the premium version of Relevanssi.
Although it’s not enabled by default, Relevanssi does allow you to track what users are searching for. You can log the IP address of searchers and exclude users from logs too, and all statistics can also be exported to a CSV file.
As you can imagine, storing search statistics can make the log database table large, but you can automatically trim these stats after a defined number of days.
The stats page shows common search queries for today and yesterday, the last seven days and the last 30 days. There’s an option to reset all stats too, but you can’t see statistics over a longer time period or filter stats for a specific time period.
Excerpts let you show a snippet of a page in search results to give users an idea of what the page contains. The length of the excerpt can be defined in characters or words, and you can include custom fields in the excerpt.
Another great feature in Relevanssi is highlighting, which lets you highlight search terms in titles, documents and comments.
You can highlight the terms by using the mark, italic or bold HTML tags. If you prefer, you can change the color of the text or the background, or use your own CSS class.
The screenshot below shows a yellow background being used to highlight the search term.
Relevanssi has good support for synonyms, which is particularly useful if your search logs show users are frequently misspelling words when performing searches.
A large list of stopwords is built into Relevanssi and there’s also a list of the most common words in your website’s index. Any words you add to the stopword list will be automatically removed from searches.
Relevanssi is primarily used to improve searching on the front-end of your website, but I appreciate the developers including a search page inside the admin area. You can use this to search through all post types by entering your own terms and parameters.
Relevanssi doesn’t have the most exciting settings area, but it does feature dozens of useful configuration options for changing how content is indexed and how searching is processed.
The premium version of Relevanssi adds a number of useful features that aren’t available in the free version. It retails at $99 for an annual license and $349 for a permanent license, and each license supports an unlimited number of websites and comes with a 30-day money back guarantee.
Once Relevanssi Premium has been activated, many new options are made available. This includes an API key field in the overview page, which has to be completed to receive automatic plugin updates.
The indexing page receives additional options for indexing user profiles, synonyms, taxonomy terms, post type archives and PDFs. A few extra advanced indexing settings are also added.
Attachments are only supported in Relevanssi Premium.
The contents of attachments will be scanned and stored in a custom field called _relevanssi_pdf_content. If you wish, you can link search results directly to the attachment file (e.g. the PDF file).
Relevanssi Premium adds more options for weights to the searching page. This lets you use post types and taxonomies as ranking factors.
Another cool feature on this page is the recent posts bonus cutoff. Rather than just set a cutoff date for older posts, Relevanssi allows you to apply a multiplier to newer articles, which greatly reduces the odds of older articles being displayed in search results. However, you can still display older posts by simply making this multiplier lower.
On the stopwords page, Relevanssi Premium introduces an option to only apply stopwords to content. This gives you greater control over what content is indexed on your website.
The last three options in the settings area are only available in the premium version of Relevanssi: Redirects, Related and Import/Export Options.
Redirects can be used to redirect certain searches to a specific page. If you pay attention to your logs page, you can see what common searches are being made and direct users to the exact page you want.
The recent posts feature in Relevanssi Premium offers many customisation options.
Recent posts can be automatically displayed on blog posts, pages and media, or, if you prefer, you can add recent posts to any page on your website using a PHP template function or a shortcode.
You can define how many related posts to display and which post types to use for it. I recommend limiting related posts to a defined number of months, because when I failed to do so articles from several years ago were displayed.
Setting a cutoff date will reduce the number of articles that are available for recent posts, but you can address this by either showing nothing, showing random posts or showing random posts from the same category.
Related posts can show the title, thumbnail and excerpt, and a default thumbnail can be defined for articles that don’t have a featured image assigned to them.
All related posts are cached so that website performance isn’t affected, and you can flush this cache at any time.
I was a little disappointed with the lack of styling options for related posts — there are no options to control colors or formatting, and all of the thumbnails are displayed using different sizes. Because of this, the final output doesn’t look great, so I can’t recommend using the related posts feature over a dedicated related posts WordPress plugin.
Backing up and transferring Relevanssi settings to another website is simple: All you have to do is copy and paste.
Relevanssi is undoubtedly one of the best search solutions available to WordPress users.
I’m particularly impressed with how many features and configuration options are available in the free version of the WordPress plugin — you can use it to instantly improve search engine functionality on your website and control what’s shown in search results (and what’s not).
The premium version of Relevanssi adds support for PDF documents and other attachments, indexing of additional taxonomies and greater control of ranking factors. Related posts are available too, but I believe one of the key reasons to upgrade is to add a cutoff date for content. This is something that’s sorely missed in the free version.
To learn more about how Relevanssi works, I recommend installing the free version on your website and visiting the official Relevanssi website.
Used/using Relevanssi? Thoughts?