Fix for Search Everything Wordpress Plugin

Finally i can activate the Search Everything plugin once again (i temporarily disabled it after upgrading to Wordpress 2.1 because of producing duplicate results. Especially if the results can be found on multiple pages). And fortunately there’s someone already found a solution for this problem (many thanks to Tiago Pocinho by creating a fix for this problem)

To fix this problem, you can simply add below lines to the search everything plugin :

add_filter(‘posts_request’, ‘SE2_distinct’);
function SE2_distinct($query){
  global $wp_query;
 
  if (!empty($wp_query->query_vars['s'])) {
    if (strstr($where, ‘DISTINCT’)) {}
    else {
      $query = str_replace(‘SELECT’, ‘SELECT DISTINCT’, $query);
    }
  }
  return $query;
}

Yep .. that’s all .. but just in case you want to see a detailed description of this problem, you can see it at Search Everything page at Google Code

Leave a comment

Comments

  1. Reaper-XReaper-X Feb 23, 2007 at 10:25 AM

    Actually i should be thanking you Dan because of your wonderful search everything plugin and by visiting this small blog :)

  2. Dan dancameron.org Feb 23, 2007 at 2:52 AM

  3. Dan dancameron.org Feb 23, 2007 at 2:52 AM

    I applied this fix and released 3.0 yesterday.

    dancameron.org/wordpress

Trackbacks/Pingbacks

  1. WordPress Arena: A Blog for WordPress Developers, Designers and Blogger
  2. Reiner Saddey’s Place » How to prevent Search Everything from returning duplicate hits with WordPress 2.1

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>