diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php index 994b9d65c..4144db6a0 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php @@ -87,8 +87,12 @@ class ThirdPartyApiSearch implements SearchApiInterface foreach ($strs as $str) { if (!empty($str)) { $wheres[] = "(LOWER(UNACCENT(?)) <<% tparty.canonicalized OR - tparty.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%')"; - $whereArgs[] = [$str, $str]; + tparty.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%') + OR + (LOWER(UNACCENT(?)) <<% parent.canonicalized OR + parent.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%') + "; + $whereArgs[] = [$str, $str, $str, $str]; $pertinence[] = 'STRICT_WORD_SIMILARITY(LOWER(UNACCENT(?)), tparty.canonicalized) + ' . "(tparty.canonicalized LIKE '%s' || LOWER(UNACCENT(?)) || '%')::int + " . // take postcode label into account, but lower than the canonicalized field