Support » Plugin: Relevanssi - A Better Search » Relevanssi Premium SQL errors since 1.15.x

  • Here’s the two errors I’m getting on each search query:

    `
    WordPress database error Unknown column ‘relevanssi.doc’ in ‘IN/ALL/ANY subquery’ for query SELECT COUNT(DISTINCT(doc)) FROM wp_relevanssi#012#011#011#011#011#011#011WHERE (term LIKE ‘%cat’ OR term LIKE ‘cat%’) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts#012#011#011#011#011WHERE posts.post_type NOT IN (‘revision’, ‘nav_menu_item’, ‘custom_css’, ‘customize_changeset’, ‘acf-field-group’, ‘acf-field’, ‘tribe_venue’, ‘tribe_organizer’, ‘deleted_event’))) OR (relevanssi.doc = -1)) AND doc IN (SELECT DISTINCT(ID) FROM wp_posts WHERE post_type=’forms’) made by require(‘wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, apply_filters_ref_array, WP_Hook->apply_filters, relevanssi_query, relevanssi_do_query, relevanssi_search_multi
    WordPress database error Unknown column ‘relevanssi.doc’ in ‘IN/ALL/ANY subquery’ for query SELECT COUNT(DISTINCT(doc)) FROM wp_relevanssi WHERE (term LIKE ‘%cat’ OR term LIKE ‘cat%’)
    AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts#012#011#011#011#011WHERE posts.post_type NOT IN (‘revision’, ‘nav_menu_item’, ‘custom_css’, ‘customize_changeset’, ‘acf-field-group’, ‘acf-field’, ‘tribe_venue’, ‘tribe_organizer’, ‘deleted_event’))) OR (relevanssi.doc = -1)) AND doc IN (SELECT DISTINCT(ID) FROM wp_posts WHERE post_type=’forms’) made by require(‘wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, apply_filters_ref_array, WP_Hook->apply_filters, relevanssi_query, relevanssi_do_query, relevanssi_search_multi
    `

    In relevanssi_search_multi, there are these three queries:

    `
    $query = “SELECT *, title + content + comment + tag + link + author + category + excerpt + taxonomy + customfield AS tf
    FROM $relevanssi_table AS relevanssi $query_join WHERE $term_cond $query_restrictions”;
    `

    `
    $query = “SELECT COUNT(DISTINCT(doc)) FROM $relevanssi_table WHERE $term_cond $query_restrictions”;
    `

    `
    $query = “SELECT COUNT(DISTINCT(doc)) FROM $relevanssi_table
    WHERE (term LIKE ‘%$term’ OR term LIKE ‘$term%’) $query_restrictions”;
    `

    The first query uses FROM $relevanssi_table AS relevanssi but the other two just use FROM $relevanssi_table. I expect that either $term_cond or $query_restrictions (or both) is using relevanssi.doc which is leading to the unknown column errors.

    Thanks,
    Tom

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

    (@msaari)

    Yeah, those two need to use FROM $relevanssi_table AS relevanssi like the first query does.

    Fixing that should get rid of the errors. I’ll release a fixed version soon.

    Thanks, Mikko. I’m always impressed by how quickly you respond. Keep up the good work.

    Plugin Author Mikko Saari

    (@msaari)

    Sure, it’s my job. And thanks for reporting these errors, good reporting makes fixing things fast much easier.

    Mikko, I am still seeing this issue in 1.16.0.1. has the fix been included in the newest release?

    Plugin Author Mikko Saari

    (@msaari)

    Looks like I missed one spot. If you change the line 576 in lib/premium_features.php from

    $query = "SELECT COUNT(DISTINCT(doc)) FROM $relevanssi_table

    to

    $query = "SELECT COUNT(DISTINCT(doc)) FROM $relevanssi_table AS relevanssi

    Does that remove the error?

    It did, but I am still getting an error when using the multisite search

    WordPress database error Unknown column 'wp_18_postmeta.post_id' in 'where clause' for query SELECT COUNT(DISTINCT(doc)) FROM wp_18_relevanssi AS relevanssi					
    WHERE (term LIKE '%excess' OR term LIKE 'excess%')  AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_18_posts AS posts
    WHERE posts.post_type NOT IN ('revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'acf-field-group', 'acf-field', 'mod_clone', 'bu_link'))) OR (relevanssi.doc = -1)) AND ( wp_18_postmeta.post_id IS NULL) 
    made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/ncfgears-search/templates/template-search.php'), relevanssi_do_query, relevanssi_search_multi, QM_DB->query
    

    it looks like its around line 555 in lib/premium_features.php

    • This reply was modified 1 year, 8 months ago by  H. Adam Lenz.
    • This reply was modified 1 year, 8 months ago by  H. Adam Lenz.

    I’m seeing another error now, should I start a new thread?

    WordPress database error Unknown column ‘wp_18_postmeta.post_id’ in ‘where clause’ for query SELECT COUNT(DISTINCT(doc)) FROM wp_18_relevanssi AS relevanssi
    WHERE (term LIKE ‘%excess’ OR term LIKE ‘excess%’) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_18_posts AS posts
    WHERE posts.post_type NOT IN (‘revision’, ‘nav_menu_item’, ‘custom_css’, ‘customize_changeset’, ‘acf-field-group’, ‘acf-field’, ‘mod_clone’, ‘bu_link’))) OR (relevanssi.doc = -1)) AND ( wp_18_postmeta.post_id IS NULL)
    made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/plugins/ncfgears-search/templates/template-search.php’), relevanssi_do_query, relevanssi_search_multi, QM_DB->query

    looks like it gets built around line 554 in lib/premium_features.php

    sorry, the code view wasn’t working for the above

    Plugin Author Mikko Saari

    (@msaari)

    A new thread would be welcome, as this is already buried on the second page and it would be helpful to have all the active threads on page one.

    But that’s a strange one – check the database, what’s up with that? The wp_18_postmeta table should definitely have a post_id column, so why is it unknown? Does the table exist? Does the subsite 18 exist at all?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Relevanssi Premium SQL errors since 1.15.x’ is closed to new replies.