From 71c62584b38ffe47bde3faf0cec2cf8598e67fb6 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Thu, 11 Jun 2020 12:21:32 -0300 Subject: [PATCH] fix concat on general search --- src/classes/class-tainacan-search-engine.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/classes/class-tainacan-search-engine.php b/src/classes/class-tainacan-search-engine.php index 3e8b7130b..98ee0124f 100644 --- a/src/classes/class-tainacan-search-engine.php +++ b/src/classes/class-tainacan-search-engine.php @@ -149,10 +149,10 @@ class Search_Engine { $seperator = ''; $not_exact = empty($this->query_instance->query_vars['exact']); $terms = $this->get_search_terms(); - $fields = implode(", ' || ', ", $search_query_fields); + $fields = implode(", ", $search_query_fields); foreach ( $terms as $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 '; } $searchQuery .= ')';