コード例 #1
0
ファイル: solr.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * onContentAvailable 
  * 
  * @param mixed $table 
  * @param mixed $model 
  * @access public
  * @return void
  */
 public function onContentAvailable($table, $model)
 {
     $type = $this->getType($table);
     $id = $model->getPkValue();
     if ($type != false) {
         \Components\Search\Helpers\SolrHelper::enqueueDB($type, array($id), 'index');
     }
 }
コード例 #2
0
ファイル: solr.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * addToBlacklistTask - Makes a database entry and removes from index
  * 
  * @access public
  * @return void
  */
 public function addToBlacklistTask()
 {
     $id = Request::getVar('id', '');
     // Make entry on blacklist
     $entry = Blacklist::oneOrNew(0);
     $entry->set('doc_id', $id);
     $entry->set('created', \Date::of()->toSql());
     $entry->set('created_by', User::getInstance()->get('id', 0));
     $entry->save();
     $item = SolrHelper::parseDocumentID($id);
     // Remove from index
     if (SolrHelper::enqueueDB($item['type'], array($item['id']), 'delete')) {
         // Redirect back to the search page.
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=documentByType&type=' . $item['type'], false), 'Submitted ' . $id . ' for removal.', 'success');
     } else {
         // Redirect back to the search page.
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=documentByType&type=' . $scope, false), 'Failed to remove ' . $id, 'error');
     }
 }