• Resolved olorin

    (@olorin)


    Since the last update, those 2 options don’t work anymore:

    – Restrict search to these categories and tags:
    or
    – Exclude these categories and tags from search:

    Usually i’m only using the first option to restrict search to one category only (for example: 17). But since the update, it searches in all categories.

    So i tried using the second option (exclusion) but it doesn’t work neither.

    Thanks for your help.

    http://wordpress.org/plugins/relevanssi/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Are you using any other filters for taxonomies?

    If you add this code to functions.php and do a search, what do you get?

    add_filter('relevanssi_query_filter', 'query_check');
    function query_check($query) {
        var_dump($query);
        return $query;
    }
    Thread Starter olorin

    (@olorin)

    Here’s what i get:

    string(321) "SELECT *, title * 10 + content + comment * 0.75 + tag * 0.75 + link * 0 + author + category * 0.75 + excerpt + taxonomy + customfield + mysqlcolumn AS tf FROM wp_relevanssi WHERE term = 'empire' AND ((doc IN (SELECT DISTINCT(ID) FROM wp_posts WHERE post_type IN ('post','page','attachment'))) OR (doc = -1))"

    And the option “Restrict search to these categories and tags” is set at “17”

    I’m having the same problem–also as of the most recent update, and also with the same two options (“Restrict search to these categories and tags” and “Exclude these categories and tags from search”).

    When I put in that code to functions.php and did a search (while having “Restrict search to these categories and tags” set to “6”), I got this:

    string(348) "SELECT *, title * 5 + content + comment * 0.75 + tag * 0.75 + link * 0 + author + category * 0.75 + excerpt + taxonomy + customfield + mysqlcolumn AS tf FROM wp_relevanssi WHERE term = 'nodules' AND ((doc IN (SELECT DISTINCT(ID) FROM wp_posts WHERE post_type IN ('post','page','attachment'))) OR (doc = -1)) ORDER BY tf DESC LIMIT 500"

    Plugin Author Mikko Saari

    (@msaari)

    Yeah, looks like there’s a wee bug in the latest version.

    For a quick fix, find this line in lib/search.php:

    $tax_query_relation = apply_filters('relevanssi_default_tax_query_relation', 'OR');

    and add after it:

    if (isset($query->tax_query) && empty($query->tax_query->queries)) $query->tax_query = null;

    That should make it work.

    Plugin Author Mikko Saari

    (@msaari)

    Actually, I just released version 3.1.8, which should fix this.

    Thread Starter olorin

    (@olorin)

    Thanks it works

    Yes, thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Exclusions and restrictions don't work anymore’ is closed to new replies.