Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ public function reindexAction()

if ($this->_request->isPost()) {
try {
$clear = $this->getRequest()->getParam('clear') ? true : false;

// Clear and reindex.
Zend_Registry::get('job_dispatcher')->sendLongRunning(
'SolrSearch_Job_Reindex'
'SolrSearch_Job_Reindex',
array('clear' => $clear)
);

// Flash success.
Expand Down
9 changes: 8 additions & 1 deletion forms/SolrSearch_Form_Reindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ public function init()

parent::init();

$this->addElement('checkbox', 'clear', array(
'label' => __('Clear index'),
));

$this->addElement('submit', 'submit', array(
'label' => __('Clear and Reindex')
'label' => __('Reindex')
));

$this->addDisplayGroup(array('clear'), 'fields');
$this->addDisplayGroup(array('submit'), 'submit_button');

}


Expand Down
5 changes: 4 additions & 1 deletion jobs/SolrSearch_Job_Reindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class SolrSearch_Job_Reindex extends Omeka_Job_AbstractJob
*/
public function perform()
{
SolrSearch_Helpers_Index::deleteAll();
if (isset($this->_options['clear']) && $this->_options['clear']) {
SolrSearch_Helpers_Index::deleteAll();
}

SolrSearch_Helpers_Index::indexAll();
}

Expand Down