*
* @return void
*/
- public function commit() {
+ protected function commit() {
$this->get_search_client()->commit();
}
+ /**
+ * Do any area cleanup needed, and do anything to confirm contents.
+ *
+ * Return false to prevent the search area completed time and stats from being updated.
+ *
+ * @param \core_search\area\base $searcharea The search area that was complete
+ * @param int $numdocs The number of documents that were added to the index
+ * @param bool $fullindex True if a full index is being performed
+ * @return bool True means that data is considered indexed
+ */
+ public function area_index_complete($searcharea, $numdocs = 0, $fullindex = false) {
+ $this->commit();
+
+ return true;
+ }
+
/**
* Defragments the index.
*
* @return void
*/
public function optimize() {
- $this->get_search_client()->optimize();
+ $this->get_search_client()->optimize(1, true, false);
}
/**
*/
public function delete_by_id($id) {
$this->get_search_client()->deleteById($id);
+ $this->commit();
}
/**
} else {
$this->get_search_client()->deleteByQuery('*:*');
}
+ $this->commit();
}
/**
'ssl_password' => !empty($this->config->ssl_keypassword) ? $this->config->ssl_keypassword : '',
'ssl_cainfo' => !empty($this->config->ssl_cainfo) ? $this->config->ssl_cainfo : '',
'ssl_capath' => !empty($this->config->ssl_capath) ? $this->config->ssl_capath : '',
+ 'timeout' => !empty($this->config->server_timeout) ? $this->config->server_timeout : '30'
);
$this->client = new \SolrClient($options);