diff --git a/Search/SimilarPersonMatcher.php b/Search/SimilarPersonMatcher.php index 2667f061f..ab13e607a 100644 --- a/Search/SimilarPersonMatcher.php +++ b/Search/SimilarPersonMatcher.php @@ -75,14 +75,18 @@ class SimilarPersonMatcher . ' OR UNACCENT(LOWER(p.lastName)) LIKE UNACCENT(LOWER(:lastName)) ' . ' OR UNACCENT(LOWER(p.firstName)) LIKE UNACCENT(LOWER(:lastName)) ' . ' OR UNACCENT(LOWER(p.lastName)) LIKE UNACCENT(LOWER(:firstName)) ' + . ' OR SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) >= 0.15 ' . ' ) ' - . ' AND p.center IN (:centers)'; + . ' AND p.center IN (:centers)' + . ' ORDER BY SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) DESC ' + ; $query = $this->em ->createQuery($dql) ->setParameter('firstName', $person->getFirstName()) ->setParameter('lastName', $person->getLastName()) + ->setParameter('fullName', $person->getFirstName() . ' ' . $person->getLastName()) ->setParameter('centers', $centers) ;