Skip to content

Commit 2bc002a

Browse files
authored
Merge pull request #4 from nestordedios/patch-1
Search only on published Records
2 parents 7a296dc + 97f769a commit 2bc002a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Controller/SearchController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Bolt\Controller\Frontend\FrontendZoneInterface;
88
use Bolt\Controller\TwigAwareController;
9+
use Bolt\Enum\Statuses;
910
use Bolt\Repository\ContentRepository;
1011
use Bolt\TntSearch\TntEngine;
1112
use Pagerfanta\Adapter\ArrayAdapter;
@@ -44,7 +45,7 @@ public function search(): Response
4445
$tnt->selectIndex('records.index');
4546

4647
$results = $tnt->search($searchTerm, 10000);
47-
$records = $this->repository->findBy(['id' => $results['ids']]);
48+
$records = $this->repository->findBy(['id' => $results['ids'], 'status' => Statuses::PUBLISHED]]);
4849
$records = new Pagerfanta(new ArrayAdapter($records));
4950
$records->setMaxPerPage($amountPerPage);
5051
$records->setCurrentPage($page);

0 commit comments

Comments
 (0)