/**
  * Pass setting to Solr search
  *
  * @param int $offset Results offset
  * @param int $limit  Limit per page
  * @return SolrResultDoc Solr results
  */
 protected function _search($offset, $limit, $limitToPublicItems = true)
 {
     // Connect to Solr.
     $solr = SolrSearch_Helpers_Index::connect();
     // Get the parameters.
     $params = $this->_getParameters();
     // Construct the query.
     $query = $this->_getQuery($limitToPublicItems);
     // Execute the query.
     return $solr->search($query, $offset, $limit, $params);
 }
 /**
  * Install SolrSearch and prepare the database.
  */
 public function setUp()
 {
     parent::setUp();
     // Create and authenticate user.
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     // Install up SolrSearch.
     $this->helper = new Omeka_Test_Helper_Plugin();
     $this->helper->setUp('SolrSearch');
     // Get tables.
     $this->fieldTable = $this->db->getTable('SolrSearchField');
     $this->elementSetTable = $this->db->getTable('ElementSet');
     $this->elementTable = $this->db->getTable('Element');
     $this->itemTypeTable = $this->db->getTable('ItemType');
     // Apply `solr.ini` values.
     $this->_applyTestingOptions();
     // Connect to Solr.
     $this->solr = SolrSearch_Helpers_Index::connect();
 }
 /**
  * When an item is deleted, clear its Solr record.
  *
  * @param array $args With `record`.
  */
 public function hookBeforeDeleteItem($args)
 {
     $item = $args['record'];
     $solr = SolrSearch_Helpers_Index::connect();
     try {
         $solr->deleteById('Item_' . $item['id']);
         $solr->commit();
         $solr->optimize();
     } catch (Exception $e) {
     }
 }