當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Index::delete方法代碼示例

本文整理匯總了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();
     }
 }
開發者ID:viz,項目名稱:wordpress-fantastic-elasticsearch,代碼行數:7,代碼來源:BaseAggregationTest.php

示例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);
 }
開發者ID:makeandship,項目名稱:wordpress-fantastic-elasticsearch,代碼行數:41,代碼來源:SnapshotTest.php

示例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);
 }
開發者ID:viz,項目名稱:wordpress-fantastic-elasticsearch,代碼行數:38,代碼來源:SnapshotTest.php

示例4: tearDown

 protected function tearDown()
 {
     $this->_index1->delete();
     $this->_index2->delete();
     parent::tearDown();
 }
開發者ID:tkaven,項目名稱:Elastica,代碼行數:6,代碼來源:IndicesTest.php

示例5: delete

 /**
  * @return \Elastica\Response
  */
 public function delete()
 {
     return $this->index->delete();
 }
開發者ID:spryker,項目名稱:Search,代碼行數:7,代碼來源:SearchIndexManager.php

示例6: tearDown

 protected function tearDown()
 {
     $this->_index->delete();
 }
開發者ID:viz,項目名稱:wordpress-fantastic-elasticsearch,代碼行數:4,代碼來源:TermTest.php

示例7: tearDown

 protected function tearDown()
 {
     $this->index->delete();
     parent::tearDown();
 }
開發者ID:viz,項目名稱:wordpress-fantastic-elasticsearch,代碼行數:5,代碼來源:BoostingTest.php

示例8: deleteIndex

 /**
  * Delete the test index after tests complete.
  */
 protected static function deleteIndex()
 {
     self::$index->delete();
 }
開發者ID:gdbots,項目名稱:pbj-php,代碼行數:7,代碼來源:ElasticaTest.php

示例9: deleteIndex

 /**
  * Удаление индекса
  */
 public function deleteIndex()
 {
     if ($this->index->exists()) {
         $this->index->delete();
     }
 }
開發者ID:anmoroz,項目名稱:yii2-analytics,代碼行數:9,代碼來源:ElasticaBase.php


注:本文中的Elastica\Index::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。