/**
  * @param array $options
  * @return string
  */
 public function search($options = [])
 {
     Search::searchBlockFound();
     $pages = [];
     if ($this->searchQuery !== false) {
         $pages = PageSearchData::lookup($this->searchQuery);
         if (!empty($pages)) {
             if (!empty($options['templates'])) {
                 foreach ($pages as $k => $page) {
                     if (!isset($page->template) || !in_array($page->template, $options['templates'])) {
                         unset($pages[$k]);
                     }
                 }
             }
             if (!empty($options['groups'])) {
                 $pageIds = [];
                 $pageGroupPages = PageGroupPage::whereIn('group_id', $options['groups'])->get();
                 foreach ($pageGroupPages as $pageGroupPage) {
                     $pageIds[] = $pageGroupPage->page_id;
                 }
                 foreach ($pages as $k => $page) {
                     if (!in_array($page->id, $pageIds)) {
                         unset($pages[$k]);
                     }
                 }
             }
             $results = count($pages);
             $showing = "";
             if ($results > 20) {
                 $page = (int) Request::input('page');
                 $page = $page < 1 ? 1 : $page;
                 $max = $page * 20 > $results ? $results : $page * 20;
                 $showing = " [showing " . (($page - 1) * 20 + 1) . " - " . $max . "]";
             }
             $options['content'] = "Search results for '" . $this->searchQuery . "' (" . $results . " match" . (count($pages) > 1 ? 'es' : null) . " found)" . $showing . ":";
         } else {
             $options['content'] = "No results found for '" . $this->searchQuery . "'.";
         }
     } else {
         $options['content'] = array_key_exists('content', $options) ? $options['content'] : "No search query entered.";
     }
     return $this->_renderCategory(0, $pages, $options);
 }