Skip to main contentSkip to footer

If best results don’t come up first and changing weighting settings doesn’t seem to make any difference, there couple of things you can do.

Is Relevanssi active?

The first thing is to check if the results are actually provided by Relevanssi. If you disable Relevanssi, do the results change? Do you see Relevanssi-generated excerpts? There are different reasons why your search results may not come from Relevanssi even if Relevanssi is activated, and the most common has to do with query posts calls. For that, see this Knowledge Base entry.

Are the results in menu_order?

I’ve seen several cases where odd search results are caused by a theme (or a plugin) that forces the search to use menu_order, for some reason. If that’s the problem, the solution is simple. Add this code to your theme functions.php:

add_filter( 'relevanssi_orderby', function ( $orderby ) { return 'relevance'; } );

Your account

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

Search

Popular Resources

10Web Photo Gallery
The Photo Gallery plugin from 10Web uses a shortcode to add photo galleries to posts and pages. By default, Relevanssi…

Related Posts:

Comment Section:

3 Comments. Leave new

  • I did this:

    add_filter( ‘relevanssi_orderby’, function ( $orderby ) { return ‘relevance’; } );

    And it took down my entire website! Currently on line to tech support to try and restore it. But I politely suggest this instruction for NOT be followed.\

    Jon

    Reply
    • Jon, the tech support will find out there’s a typo in the code. The code itself cannot do harm like that, but a smallest typo – a missing brace, for example – can crash a site.

      Reply
  • After debugging for hours I found you need to make sure your functions.php doesnt have;

    add_filter(‘facetwp_use_search_relevancy’, ‘__return_false’);

    AND

    function [theme_name]_facetwp_alter_sort_options($options, $params) {
    return [];
    }
    add_filter(‘facetwp_sort_options’, ‘ [theme_name]_facetwp_alter_sort_options’, 10, 2);

    Both of these will skip the Relevanssi sorting

    Reply

Leave a Reply to Ashhad Sameer Cancel 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