Skip to content

Commit 438f97c

Browse files
committed
fix: preserve underscores in fulltext search value sanitization
1 parent f3bdc34 commit 438f97c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Database/Adapter/Postgres.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,8 +1921,8 @@ protected function getFulltextValue(string $value): string
19211921
{
19221922
$exact = str_ends_with($value, '"') && str_starts_with($value, '"');
19231923

1924-
/** Keep only unicode letters, numbers, and whitespace. */
1925-
$value = preg_replace('/[^\p{L}\p{N}\s]/u', ' ', $value);
1924+
/** Keep only unicode letters, numbers, underscores, and whitespace. */
1925+
$value = preg_replace('/[^\p{L}\p{N}_\s]/u', ' ', $value);
19261926
$value = preg_replace('/\s+/', ' ', $value); // Remove multiple whitespaces
19271927
$value = trim($value);
19281928

src/Database/Adapter/SQL.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,8 +1752,8 @@ protected function getFulltextValue(string $value): string
17521752
{
17531753
$exact = str_ends_with($value, '"') && str_starts_with($value, '"');
17541754

1755-
/** Keep only unicode letters, numbers, and whitespace. */
1756-
$value = preg_replace('/[^\p{L}\p{N}\s]/u', ' ', $value);
1755+
/** Keep only unicode letters, numbers, underscores, and whitespace. */
1756+
$value = preg_replace('/[^\p{L}\p{N}_\s]/u', ' ', $value);
17571757
$value = preg_replace('/\s+/', ' ', $value); // Remove multiple whitespaces
17581758
$value = trim($value);
17591759

0 commit comments

Comments
 (0)