public function searchAction()
{
$this->tag->setTitle('Search Results');
$q = $this->request->getQuery('q');
$indexer = new Indexer();
$posts = $indexer->search(['title' => $q, 'content' => $q], 50, true);
if (!count($posts)) {
$posts = $indexer->search(['title' => $q], 50, true);
if (!count($posts)) {
$this->flashSession->notice('There are no search results');
return $this->response->redirect();
}
}
$paginator = new \stdClass();
$paginator->count = 0;
$this->view->setVars(['posts' => $posts, 'totalPosts' => $paginator, 'currentOrder' => null, 'offset' => 0, 'paginatorUri' => 'search']);
}