[person search] increase pertinence when person's lastname starts with

search pattern
This commit is contained in:
2021-11-29 23:24:34 +01:00
parent 54a4b48174
commit acc4647346
2 changed files with 4 additions and 2 deletions

View File

@@ -137,8 +137,9 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
$pertinence[] =
'STRICT_WORD_SIMILARITY(LOWER(UNACCENT(?)), person.fullnamecanonical) + ' .
"(person.fullnamecanonical LIKE '%' || LOWER(UNACCENT(?)) || '%')::int + " .
"(EXISTS (SELECT 1 FROM unnest(string_to_array(fullnamecanonical, ' ')) AS t WHERE starts_with(t, UNACCENT(LOWER(?)))))::int";
array_push($pertinenceArgs, $str, $str, $str);
"(EXISTS (SELECT 1 FROM unnest(string_to_array(fullnamecanonical, ' ')) AS t WHERE starts_with(t, UNACCENT(LOWER(?)))))::int + " .
'(starts_with(LOWER(UNACCENT(lastname)), UNACCENT(LOWER(?))))::int';
array_push($pertinenceArgs, $str, $str, $str, $str);
$orWhereSearchClause[] =
'(LOWER(UNACCENT(?)) <<% person.fullnamecanonical OR ' .