Skip to content

Commit 0e1c9d3

Browse files
committed
Allow to search blog posts with unicode characters
1 parent 5259ad7 commit 0e1c9d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Repository/PostRepository.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ public function findBySearchQuery(string $rawQuery, int $limit = Post::NUM_ITEMS
9494
*/
9595
private function sanitizeSearchQuery(string $query): string
9696
{
97-
return preg_replace('/[^[:alnum:] ]/', '', trim(preg_replace('/[[:space:]]+/', ' ', $query)));
97+
return trim(preg_replace('/[[:space:]]+/', ' ', $query));
9898
}
9999

100100
/**
101101
* Splits the search query into terms and removes the ones which are irrelevant.
102102
*/
103103
private function extractSearchTerms(string $searchQuery): array
104104
{
105-
$terms = array_unique(explode(' ', mb_strtolower($searchQuery)));
105+
$terms = array_unique(explode(' ', $searchQuery));
106106

107107
return array_filter($terms, function ($term) {
108108
return 2 <= mb_strlen($term);

0 commit comments

Comments
 (0)