From 645549ae34768af8860f1cd69d94b7da15c38d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Apr 2022 21:45:49 +0200 Subject: [PATCH] effectively filter on all words in third party search --- .../ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php index f43a6eda2..83a2add2d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php @@ -85,12 +85,12 @@ class ThirdPartyApiSearch implements SearchApiInterface $pertinenceArgs = []; foreach ($strs as $str) { - if (!empty($str)) { - $wheres[] = "(LOWER(UNACCENT(?)) <<% tparty.canonicalized OR + if ('' !== trim($str)) { + $wheres[] = "((LOWER(UNACCENT(?)) <<% tparty.canonicalized OR tparty.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%') OR (LOWER(UNACCENT(?)) <<% parent.canonicalized OR - parent.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%') + parent.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%')) "; $whereArgs[] = [$str, $str, $str, $str]; $pertinence[] = 'GREATEST(