thirdparty search: add where clause for searching into children

This commit is contained in:
nobohan 2022-02-15 13:16:04 +01:00
parent f2221565c5
commit bc99c85802

View File

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