fix: étendre la recherche aux identifications

This commit is contained in:
Alexandre NOEL 2026-09-15 21:50:34 +02:00
commit a932db0ace
8 changed files with 66 additions and 12 deletions

View file

@ -29,6 +29,17 @@ final class DB
$pdo->exec('PRAGMA busy_timeout = 3000;');
@chmod($dbPath, 0600);
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$pdo->sqliteCreateFunction(
'search_fold',
static function (mixed $value): string {
$text = mb_strtolower(trim((string) $value), 'UTF-8');
$text = strtr($text, ['œ' => 'oe', 'æ' => 'ae', 'ø' => 'o', 'ß' => 'ss']);
$ascii = @iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $text);
return $ascii === false ? $text : strtolower($ascii);
},
1,
PDO::SQLITE_DETERMINISTIC,
);
self::$pdo = $pdo;
return $pdo;