Make WordPress Core

Ticket #6410: patch-for-ticket-6410

File patch-for-ticket-6410, 825 bytes (added by bertilow, 19 years ago)

Added a patch implementing my solution

Line 
1Index: query.php
2===================================================================
3--- query.php (revision 7565)
4+++ query.php (working copy)
5@@ -973,9 +973,11 @@
6 }
7 $n = ($q['exact']) ? '' : '%';
8 $searchand = '';
9+ // Add a COLLATE statement to the searches if a special collation is defined
10+ if ($wpdb->collate) $collatesql = ' COLLATE ' . $wpdb->collate;
11 foreach((array)$q['search_terms'] as $term) {
12 $term = addslashes_gpc($term);
13- $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))";
14+ $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}'$collatesql) OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'$collatesql))";
15 $searchand = ' AND ';
16 }
17 $term = $wpdb->escape($q['s']);