The search box is an essential feature of every website that helps visitors find the content they are looking for.
Unfortunately, search remains an area where the core version of WordPress still disappoints. WordPress only searches through the title and content of post types and is unable to search through taxonomies, custom fields or attachments. WordPress also produces irrelevant results, 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 would 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 find relevant content. It does this by allowing partial keyword matching, searches with 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, however 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, 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 has not been optimised for WordPress websites with more than 30,000 posts to index.
In practice, I do not 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.
Whilst many website owners use Relevanssi this way, my advice is to go through all of the Relevanssi settings pages so that you can optimise features and options for your website.
Nine pages are available in the settings area. Two of these pages, attachments and redirects, are restricted to the premium version of the plugin.
The overview page guides you through the initial steps of using Relevanssi. After indexing content, you will be advised to go to the searching and excerpts and highlights 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. Punctuation can also be configured here. 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, however 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. You can also hide custom post types by setting exclude_from_search to true.
There is no way to restrict content by publication date, however this feature is available in the premium version of Relevanssi.
Although it is 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. All statistics can also be exported to a CSV file.
As you can imagine, storing search statistics can make the log database table large, however 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 is an option to reset all stats too, but you cannot 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. This 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 colour 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. This is particularly useful if your serch logs show that users are frequently misspelling words when performing searches.
A large list of stopwords is built into Relevanssi and there is also a list of the most common words that are 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, however 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 does not 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 which are not available in the free version. It retails at $99 for an annual license and $349 for a permanent license. 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 in order 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. This 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. 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 as 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, however 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. A default thumbnail can be defined for articles that do not have a featured image assigned to them.
All related posts are cached so that website performance is not affected and 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 colours or formatting and all of the thumbnails were displayed using different sizes. Due to this, the final output didn’t look great, so I cannot 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 was 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 is shown in search results and what is 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 is sorely missed in the free version.
If you are considering Relevanssi Premium, I recommend checking out SearchWP too. Its user-interface is more refined and it lets you track statistics beyond 30 days. Check out our full review of SearchWP to find out more.
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?