[wp-trac] [WordPress Trac] #14722: use MATCH/AGAINST instead of LIKE when querying for matching terms posts
WordPress Trac
wp-trac at lists.automattic.com
Sat Aug 28 22:07:36 UTC 2010
#14722: use MATCH/AGAINST instead of LIKE when querying for matching terms posts
-------------------------+--------------------------------------------------
Reporter: pgentoo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Performance | Version: 3.0.1
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
Comment(by scribu):
Something like this (not tested):
{{{
function alter_search($sql, $wp_query) {
global $wpdb;
$search = $wp_query->get('s');
return $wpdb->prepare(" AND MATCH($wpdb->posts.post_title,
$wpdb->posts.post_content) AGAINST(%s)", $search );
}
add_filter('posts_search', 'alter_search', 10, 2);
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14722#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list