Skip to main contentSkip to footer

Query Monitor is by far the best thing for a WordPress developer. It’s billed as the “Developer Tools panel for WordPress”, and that’s a good way to put it. If you’ve ever used the browser developer tools, you know what to expect.

Query Monitor is a good way to figure out problems in Relevanssi searches, as it’s the easiest way to see the database query Relevanssi is doing. That’s a good way to find out if there are unexpected filtering rules or something like that blocking posts from the results.

After you install Query Monitor from the plugin repository and activate it, it shows up in your admin bar:

Query Monitor appearance in the admin bar
Query Monitor output marked with the red border. The output includes the page generation time (0.43s), peak memory use (8,452kB), number of database time spent (0.0217s) and the number of database queries (50 queries). Very helpful for optimizing your site performance!

Clicking the admin bar output opens up the Query Monitor panel and from there, you can access all sorts of information. When debugging Relevanssi searching issues, we’re mostly interested in the Queries part, and you can set the “Caller” to relevanssi_search() to exclude all non-Relevanssi queries.

Query Monitor Queries panel

The highlighted query that begins with SELECT DISTINCT(relevanssi.doc) is the main Relevanssi search query and the one we’re interested in, as all search filters that affect the search query (taxonomy filters, custom field filters, date filters and so on) will appear there. This here is a very basic query, it just looks for posts with the search term “copy”.

This query can also point out some problems with the weights. The weights for titles, content and so on appear in the query: you can see in the beginning there’s relevanssi.title * 5 + relevanssi.content * 5 + relevanssi.comment * 0.75 and so on. This means the titles and content have a weight of 5, while comments have a weight of 0.75. Having a 0 weight for titles or content is a fairly common problem that can be spotted from the query.

This is the most relevant part in Query Monitor for Relevanssi debugging use, but the plugin is a treasure trove of useful debugging information, and every WordPress developer should always use this plugin.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Adding a search form in the navigation menu

…the SearchWP Modal Search Form. As the name says, the plugin is from the SearchWP developer Jon Christopher, but it also works great with Relevanssi. This plugin can easily add a search feature to your navigation menu or a site header. The search form also works great on mobile devices….…header. That’s a good reference if you want to build a nice search form in the header. If your theme does not include a built-in search form and you’re not interested in building one yourself, one of the best plugin options is the SearchWP Modal Search Form. As the name…WordPress doesn’t make adding a search form in the navigation menu easy. It’s a popular request, though, and having access to the search in the site header is typical. Relevanssi itself doesn’t have opinions on the user interface. Some themes, like Twenty Twenty, include a built-in search feature in the…

Related Posts:

Currently there are no related posts available.

Comment Section:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed