fix concat on general search

This commit is contained in:
vnmedeiros 2020-06-11 12:21:32 -03:00
parent 1ecb4d79cc
commit 71c62584b3
1 changed files with 2 additions and 2 deletions

View File

@ -149,10 +149,10 @@ class Search_Engine {
$seperator = ''; $seperator = '';
$not_exact = empty($this->query_instance->query_vars['exact']); $not_exact = empty($this->query_instance->query_vars['exact']);
$terms = $this->get_search_terms(); $terms = $this->get_search_terms();
$fields = implode(", ' || ', ", $search_query_fields); $fields = implode(", ", $search_query_fields);
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
$esc_term = $wpdb->prepare("%s", $not_exact ? "%".$term."%" : $term); $esc_term = $wpdb->prepare("%s", $not_exact ? "%".$term."%" : $term);
$searchQuery .= "{$seperator}CONCAT_WS( $fields ) LIKE $esc_term"; $searchQuery .= "{$seperator}CONCAT_WS(' || ', $fields ) LIKE $esc_term";
$seperator = ' OR '; $seperator = ' OR ';
} }
$searchQuery .= ')'; $searchQuery .= ')';