Skip to content

Commit 3058213

Browse files
committed
Minor tweaks
1 parent 9e92923 commit 3058213

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Repository/PostRepository.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public function findLatest(int $page = 1, Tag $tag = null): Paginator
5656
/**
5757
* @return Post[]
5858
*/
59-
public function findBySearchQuery(string $rawQuery, int $limit = Post::NUM_ITEMS): array
59+
public function findBySearchQuery(string $query, int $limit = Post::NUM_ITEMS): array
6060
{
61-
$searchTerms = $this->extractSearchTerms($rawQuery);
61+
$searchTerms = $this->extractSearchTerms($query);
6262

6363
if (0 === \count($searchTerms)) {
6464
return [];
@@ -88,9 +88,7 @@ private function extractSearchTerms(string $searchQuery): array
8888
$searchQuery = trim(preg_replace('/[[:space:]]+/', ' ', $searchQuery));
8989
$terms = array_unique(explode(' ', $searchQuery));
9090

91-
/*
92-
* Search terms with a very small length are left out.
93-
*/
91+
// ignore the search terms that are too short
9492
return array_filter($terms, function ($term) {
9593
return 2 <= mb_strlen($term);
9694
});

0 commit comments

Comments
 (0)