Odd Bug
-
I am using your plugin just precache certain search results. I am getting this error. (Using the newest version of your plugin) and newest version of wordpress
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)) AND ((doc IN (SELECT DISTINCT(ID) FROM wp_posts WHERE post_type IN (‘post” at line 3]
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 LIKE ‘%picks’ OR term LIKE ‘picks%’) AND doc NOT IN (18) AND doc IN (SELECT DISTINCT(ID) FROM wp_posts WHERE post_author IN ()) AND ((doc IN (SELECT DISTINCT(ID) FROM wp_posts WHERE post_type IN (‘post’))) OR (doc = -1)) ORDER BY tf DESC LIMIT 500I am running this code in a cron script:
$args = array( 's' => $sQuery, 'posts_per_page' => 10, 'post_type' => 'post', 'post__not_in' => array($this->_post_id), 'ignore_sticky_posts' => 1, 'post_status' => 'publish' ); $query = new WP_Query($args); if (function_exists("relevanssi_do_query")) { relevanssi_do_query($query); }I have tracked this down to the file \lib\search.php line 833 which looks like this:
if (isset($query->query_vars["author"])) { $author = explode(',', $query->query_vars["author"]); }I var_dump $query->query_vars and i get this (i am only showing the author part because i do not believe the rest really matter or help, let me know if you would like to see what the rest looks like):
[“author”]=> string(0) “”
when you check if that isset, you get true, and when you explode it you get an array with 1 key and the value is “”.
Array ( [0] => )Changing line 833 to
if (isset($query->query_vars["author"]) && $query->query_vars["author"] != "") {solves the problem. Are you able to shed some light as to why this is occurring or are we able to have the next version of relevanssi include this change?
The topic ‘Odd Bug’ is closed to new replies.