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 = []; $pertinenceArgs = [];
foreach ($strs as $str) { foreach ($strs as $str) {
if (!empty($str)) { if ('' !== trim($str)) {
$wheres[] = "(LOWER(UNACCENT(?)) <<% tparty.canonicalized OR $wheres[] = "((LOWER(UNACCENT(?)) <<% tparty.canonicalized OR
tparty.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%') tparty.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%')
OR OR
(LOWER(UNACCENT(?)) <<% parent.canonicalized OR (LOWER(UNACCENT(?)) <<% parent.canonicalized OR
parent.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%') parent.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%'))
"; ";
$whereArgs[] = [$str, $str, $str, $str]; $whereArgs[] = [$str, $str, $str, $str];
$pertinence[] = 'GREATEST( $pertinence[] = 'GREATEST(