Exemple #1
0
 public function searchIndexTask()
 {
     // Display CMS errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Instantiate search engine
     $hubSearch = new SearchEngine();
     // Get all of the registered hubtypes
     $this->view->types = HubType::all()->rows();
     // Count indexed documents
     foreach ($this->view->types as $type) {
         // Search across everything
         $queryString = '*:*';
         // Perform an overall search
         $search = $hubSearch->search($queryString)->addFacet('count', 'hubtype:' . $type->type);
         // Get the result, but don't chain it back
         $result = $search->getResult();
         // Get facet count
         $type->docCount = $search->getFacetCount('count');
         // Fields description
         $type->structure = $type->structure();
     }
     // Display the view
     $this->view->display();
 }
 public function saveSchemaTask()
 {
     $pairings = Request::getVar('input', array());
     $pairings = serialize($pairings);
     // The Hubtype
     $type = Request::getVar('type', '');
     $hubType = HubType::all()->where('type', '=', $type)->row();
     $hubType->set('documentMatching', $pairings);
     if (!$hubType->save()) {
         // error
     }
     // Add hubType to search index table
     $queue = IndexQueue::oneOrNew(0);
     $queue->set('hubtype_id', $hubType->get('id'));
     if (!$queue->save()) {
         // error
     }
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=solr&task=searchindex', false), 'Successfully added to index queue.', 'success');
 }