Beispiel #1
0
 public function documentByTypeTask()
 {
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $additionalQuery = Request::getVar('filter', '');
     $type = Request::getVar('type', '');
     if ($type != '') {
         // Instatiate new Engine Class
         $hubSearch = new SearchEngine();
         // Automatically apply type filter
         $queryString = 'hubtype:' . $type;
         // For filtering within results
         if ($additionalQuery != '') {
             $queryString .= ' AND ' . $additionalQuery;
             $this->view->filter = $additionalQuery;
         } else {
             $this->view->filter = '';
         }
         // @FIXME acertain from real document type.
         $fields = array('hubtype', 'hubid', 'scope', 'scope_id', 'id', 'title', 'author', 'created', 'timestamp', '_version_');
         // Apply the query and push the results to the view.
         $hubSearch->search($queryString);
         $hubSearch->setFields($fields);
         $this->view->documents = $hubSearch->getResult();
         $this->view->type = $type;
         // Display the document
         $this->view->setLayout('document');
         $this->view->display();
     } else {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=searchindex', false), 'Failed to locate HubType.', 'error');
     }
 }