Index: trunk/extensions/SemanticForms/includes/SF_AutocompleteAPI.php |
— | — | @@ -127,10 +127,10 @@ |
128 | 128 | $property_name = str_replace(' ', '_', $property_name); |
129 | 129 | $conditions = "p_ids.smw_title = '$property_name'"; |
130 | 130 | if ($substring != null) { |
131 | | - $substring = str_replace(' ', '_', strtolower($substring)); |
132 | | - $substring = str_replace('_', '\_', $substring); |
133 | | - $substring = str_replace("'", "\'", $substring); |
134 | | - $conditions .= " AND (LOWER(CONVERT($value_field USING utf8)) LIKE '" . $substring . "%' OR LOWER(CONVERT($value_field USING utf8)) LIKE '%\_" . $substring . "%')"; |
| 131 | + $substring = str_replace("'", "\'", strtolower($substring)); |
| 132 | + // utf8 conversion is needed in case MediaWiki is using |
| 133 | + // binary data storage |
| 134 | + $conditions .= " AND (REPLACE(LOWER(CONVERT($value_field USING utf8)),'_',' ') LIKE '" . $substring . "%' OR REPLACE(LOWER(CONVERT($value_field USING utf8)),'_',' ') LIKE '% " . $substring . "%')"; |
135 | 135 | } |
136 | 136 | $sql_options['ORDER BY'] = $value_field; |
137 | 137 | $res = $db->select( $from_clause, |