effectively filter on all words in third party search

This commit is contained in:
Julien Fastré 2022-04-06 21:45:49 +02:00
parent 612d053892
commit 645549ae34

View File

@ -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(