Errors when using “searchblogs”
-
Whenever i use searchblogs to search more than one subsite I get an error
WordPress database error Unknown column 'wp_postmeta.post_id' in 'where clause' for query SELECT COUNT(DISTINCT(doc)) FROM wp_relevanssi AS relevanssi WHERE term = 'major' AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_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_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
for each blog id in the searchblogs query var so if that var is 1,5,10 I would get this same error and the only difference is
wp_postmeta.post_id wp_5_postmeta.post_id wp_10_postmeta.post_id
So I used the filter
relevanssi_query_filter
which is right near where the error is to output the query. it looks likeSELECT *, title + content + comment + tag + link + author + category + excerpt + taxonomy + customfield AS tf FROM wp_18_relevanssi AS relevanssi LEFT JOIN wp_18_postmeta ON (relevanssi.doc = wp_18_postmeta.post_id AND wp_18_postmeta.meta_key = 'exclude_local_search' ) WHERE (term LIKE '%major' OR term LIKE 'major%') 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) ORDER BY tf DESC LIMIT 100
and it runs in phpMyAdmin and returns good data. In fact, this runs on the front end, it just throws an error and is clogging up my php error log.
- The topic ‘Errors when using “searchblogs”’ is closed to new replies.