Support » Plugin: SearchAutocomplete » Does not work with Relevanssi

  • Resolved imHavoc

    (@imhavoc)


    This is the error I get with relevanssi enabled.

    2014/11/02 12:15:19 [error] 1029#0: *670 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: stdClass::$is_admin in /var/www/html/wp-content/plugins/relevanssi/lib/search.php on line 1089
    PHP message: PHP Notice:  Undefined index: paged in /var/www/html/wp-content/plugins/relevanssi/lib/search.php on line 1091" while reading response header from upstream, client: xxx.xxx.x.xx, server: xxx.xxx.x.x, request: "GET /wp-admin/admin-ajax.php?action=autocompleteCallback&term=blue HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxx.xxx.x.x", referrer: "http://xxx.xxx.x.x/xx/xxxxxxxx-xxxx-xxxx-xxxxx"

    Unfortunately, I do not have a live site to show the error. If you need more var dumps let me know.

    https://wordpress.org/plugins/search-autocomplete/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Gabe Shackle

    (@hereswhatidid)

    Does this happen when Search Autocomplete is disabled and Relevanssi is enabled?

    Thread Starter imHavoc

    (@imhavoc)

    This happens when Search Autocomplete (SA) is enabled and Relevanssi is enabled and Relevanssi is set to True in SA settings. Doing a search using Relevanssi does not throw the error, only when typing into the search bar and waiting for the delay to kick in.

    With Relevanssi set to False in SA settings, the suggestions actually show.

    Thread Starter imHavoc

    (@imhavoc)

    So I had some time to do a little further digging and this is what I have come up with.

    The script is throwing out two errors:
    line 1089: if ($query->is_admin) $make_excerpts = false;
    line 1091: if ($query->query_vars['paged'] > 0) {

    is_admin checks to see if the administration panel is being displayed. Notice, for ajax requests is_admin will always return true. And the log is saying the property is not even defined, so either WP has a problem on its backend or the variable is getting lost mid-way through.

    So I looked to see where SA was passing the variable from. It looks like the first occurrence of $query is on line 123, defining it as a global variable. Did a quick dump of the variable into the log and nothing shows up. This had me confused because I know $wp_query is a WP global variable, but I was not sure of $query, or if you had defined it somewhere earlier.

    Did a little testing and changed $query to $wp_query on line 123 and all the instances of it and that fixed the first error. The second error is still occurring. Which seems to be firing off because the paged index is not set, which I thought $wp_query would have taken care of by setting the default values.

    None the less, tested this out by putting $wp_query->query_vars['paged'] = 1; right below all the others. And this seems to make everything work.

    So for the time being it is working. My fixes may not be the “right” way to do things or you might have other reasonings behind everything, but hope this helps you.

    Plugin Author Gabe Shackle

    (@hereswhatidid)

    These should be cleared up in the latest version (2.1.12)

    Plugin Author Gabe Shackle

    (@hereswhatidid)

    Closing due to inactivity.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Does not work with Relevanssi’ is closed to new replies.