Title: Odd Bug
Last modified: August 21, 2016

---

# Odd Bug

 *  Resolved [silvios](https://wordpress.org/support/users/silvios/)
 * (@silvios)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/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 500
 * I 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?
 * [https://wordpress.org/plugins/relevanssi/](https://wordpress.org/plugins/relevanssi/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/odd-bug/#post-4709336)
 * I believe you’re using an old version of Relevanssi – this is a familiar bug,
   and one that I fixed several versions ago.
 *  Thread Starter [silvios](https://wordpress.org/support/users/silvios/)
 * (@silvios)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/odd-bug/#post-4709380)
 * perfect thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Odd Bug’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [silvios](https://wordpress.org/support/users/silvios/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/odd-bug/#post-4709380)
 * Status: resolved