本文整理汇总了PHP中Elastica\Index::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::delete方法的具体用法?PHP Index::delete怎么用?PHP Index::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elastica\Index
的用法示例。
在下文中一共展示了Index::delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
protected function tearDown()
{
parent::tearDown();
if ($this->_index instanceof Index) {
$this->_index->delete();
}
}
示例2: testSnapshotAndRestore
/**
* @group functional
*/
public function testSnapshotAndRestore()
{
$repositoryName = 'testrepo';
$location = $this->_snapshotPath . 'backup2';
// register the repository
$response = $this->_snapshot->registerRepository($repositoryName, 'fs', array('location' => $location));
$this->assertTrue($response->isOk());
// create a snapshot of our test index
$snapshotName = 'test_snapshot_1';
$response = $this->_snapshot->createSnapshot($repositoryName, $snapshotName, array('indices' => $this->_index->getName()), true);
// ensure that the snapshot was created properly
$this->assertTrue($response->isOk());
$this->assertArrayHasKey('snapshot', $response->getData());
$data = $response->getData();
$this->assertContains($this->_index->getName(), $data['snapshot']['indices']);
$this->assertEquals(1, sizeof($data['snapshot']['indices']));
// only the specified index should be present
$this->assertEquals($snapshotName, $data['snapshot']['snapshot']);
// retrieve data regarding the snapshot
$response = $this->_snapshot->getSnapshot($repositoryName, $snapshotName);
$this->assertContains($this->_index->getName(), $response['indices']);
// delete our test index
$this->_index->delete();
// restore the index from our snapshot
$response = $this->_snapshot->restoreSnapshot($repositoryName, $snapshotName, array(), true);
$this->assertTrue($response->isOk());
$this->_index->refresh();
$this->_index->optimize();
// ensure that the index has been restored
$count = $this->_index->getType('test')->count();
$this->assertEquals(sizeof($this->_docs), $count);
// delete the snapshot
$response = $this->_snapshot->deleteSnapshot($repositoryName, $snapshotName);
$this->assertTrue($response->isOk());
// ensure that the snapshot has been deleted
$this->setExpectedException('Elastica\\Exception\\NotFoundException');
$this->_snapshot->getSnapshot($repositoryName, $snapshotName);
}
示例3: testSnapshotAndRestore
public function testSnapshotAndRestore()
{
$repositoryName = "test_repository";
$location = "/tmp/{$repositoryName}";
// register the repository
$response = $this->_snapshot->registerRepository($repositoryName, "fs", array("location" => $location));
$this->assertTrue($response->isOk());
// create a snapshot of our test index
$snapshotName = "test_snapshot_1";
$response = $this->_snapshot->createSnapshot($repositoryName, $snapshotName, array("indices" => $this->_index->getName()), true);
// ensure that the snapshot was created properly
$this->assertTrue($response->isOk());
$this->assertArrayHasKey("snapshot", $response->getData());
$data = $response->getData();
$this->assertContains($this->_index->getName(), $data["snapshot"]["indices"]);
$this->assertEquals(1, sizeof($data["snapshot"]["indices"]));
// only the specified index should be present
$this->assertEquals($snapshotName, $data["snapshot"]["snapshot"]);
// retrieve data regarding the snapshot
$response = $this->_snapshot->getSnapshot($repositoryName, $snapshotName);
$this->assertContains($this->_index->getName(), $response["indices"]);
// delete our test index
$this->_index->delete();
// restore the index from our snapshot
$response = $this->_snapshot->restoreSnapshot($repositoryName, $snapshotName, array(), true);
$this->assertTrue($response->isOk());
$this->_index->refresh();
$this->_index->optimize();
// ensure that the index has been restored
$count = $this->_index->getType("test")->count();
$this->assertEquals(sizeof($this->_docs), $count);
// delete the snapshot
$response = $this->_snapshot->deleteSnapshot($repositoryName, $snapshotName);
$this->assertTrue($response->isOk());
// ensure that the snapshot has been deleted
$this->setExpectedException('Elastica\\Exception\\NotFoundException');
$this->_snapshot->getSnapshot($repositoryName, $snapshotName);
}
示例4: tearDown
protected function tearDown()
{
$this->_index1->delete();
$this->_index2->delete();
parent::tearDown();
}
示例5: delete
/**
* @return \Elastica\Response
*/
public function delete()
{
return $this->index->delete();
}
示例6: tearDown
protected function tearDown()
{
$this->_index->delete();
}
示例7: tearDown
protected function tearDown()
{
$this->index->delete();
parent::tearDown();
}
示例8: deleteIndex
/**
* Delete the test index after tests complete.
*/
protected static function deleteIndex()
{
self::$index->delete();
}
示例9: deleteIndex
/**
* Удаление индекса
*/
public function deleteIndex()
{
if ($this->index->exists()) {
$this->index->delete();
}
}