Fix issue in reseter when an index does not exist yet

This commit is contained in:
ornicar 2011-04-15 14:28:51 -07:00
parent 8f3b39d135
commit 333f8850cf

View file

@ -2,6 +2,8 @@
namespace FOQ\ElasticaBundle;
use Elastica_Exception_Response;
/**
* Deletes and recreates indexes
**/
@ -22,7 +24,11 @@ class Reseter
public function reset()
{
foreach ($this->indexManager->getAllIndexes() as $index) {
$index->delete();
try {
$index->delete();
} catch (Elastica_Exception_Response $e) {
// The index does not exist
}
$index->create();
}
}