当前位置: 首页>>代码示例>>PHP>>正文


PHP Index::getName方法代码示例

本文整理汇总了PHP中Elastica\Index::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::getName方法的具体用法?PHP Index::getName怎么用?PHP Index::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Elastica\Index的用法示例。


在下文中一共展示了Index::getName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: matchDoc

 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                  $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query Not implemented yet
  * @return \Elastica\Response
  */
 public function matchDoc(Document $doc, $query = null)
 {
     $path = $this->_index->getName() . '/type/_percolate';
     $data = array('doc' => $doc->getData());
     $response = $this->getIndex()->getClient()->request($path, Request::GET, $data);
     $data = $response->getData();
     return $data['matches'];
 }
开发者ID:kskod,项目名称:Elastica,代码行数:15,代码来源:Percolator.php

示例2: matchDoc

 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                   $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query Query to filter the percolator queries which
  *                                                                     are executed.
  * @param  string                                               $type
  * @return array With matching registered queries.
  */
 public function matchDoc(Document $doc, $query = null, $type = 'type')
 {
     $path = $this->_index->getName() . '/' . $type . '/_percolate';
     $data = array('doc' => $doc->getData());
     // Add query to filter the percolator queries which are executed.
     if ($query) {
         $query = Query::create($query);
         $data['query'] = $query->getQuery();
     }
     $response = $this->getIndex()->getClient()->request($path, Request::GET, $data);
     $data = $response->getData();
     return $data['matches'];
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:22,代码来源:Percolator.php

示例3: matchDoc

 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                  $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query Query to filter the data
  * @return \Elastica\Response
  */
 public function matchDoc(Document $doc, $query = null)
 {
     $path = $this->_index->getName() . '/type/_percolate';
     $data = array('doc' => $doc->getData());
     // Add query to filter results after percolation
     if ($query) {
         $query = Query::create($query);
         $data['query'] = $query->getQuery();
     }
     $response = $this->getIndex()->getClient()->request($path, Request::GET, $data);
     $data = $response->getData();
     return $data['matches'];
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:20,代码来源:Percolator.php

示例4: matchExistingDoc

 /**
  * Percolating an existing document.
  *
  * @param string                                               $id
  * @param string                                               $type
  * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query  Query to filter the percolator queries which
  *                                                                     are executed.
  * @param array                                                $params Supports setting additional request body options to the percolate request.
  *                                                                     [ Percolator::EXTRA_FILTER,
  *                                                                     Percolator::EXTRA_QUERY,
  *                                                                     Percolator::EXTRA_SIZE,
  *                                                                     Percolator::EXTRA_TRACK_SCORES,
  *                                                                     Percolator::EXTRA_SORT,
  *                                                                     Percolator::EXTRA_FACETS,
  *                                                                     Percolator::EXTRA_AGGS,
  *                                                                     Percolator::EXTRA_HIGHLIGHT ]
  *
  * @return array With matching registered queries.
  */
 public function matchExistingDoc($id, $type, $query = null, $params = array())
 {
     $id = urlencode($id);
     $path = $this->_index->getName() . '/' . $type . '/' . $id . '/_percolate';
     $data = array();
     $this->_applyAdditionalRequestBodyOptions($params, $data);
     return $this->_percolate($path, $query, $data, $params);
 }
开发者ID:nadeem-khan,项目名称:Elastica,代码行数:27,代码来源:Percolator.php

示例5: sendMapping

 /**
  * @param \Elastica\Index $index
  * @param string $mappingName
  * @param array $mappingData
  *
  * @return void
  */
 protected function sendMapping(Index $index, $mappingName, array $mappingData)
 {
     $type = $index->getType($mappingName);
     $this->messenger->info(sprintf('Send mapping type "%s" (index: "%s")', $mappingName, $index->getName()));
     $mapping = new Mapping($type);
     foreach ($mappingData as $key => $value) {
         $mapping->setParam($key, $value);
     }
     $mapping->send();
 }
开发者ID:spryker,项目名称:Search,代码行数:17,代码来源:IndexInstaller.php

示例6: testIndicesFilter

 public function testIndicesFilter()
 {
     $filter = new Indices(new BoolNot(new Term(array("color" => "blue"))), array($this->_index1->getName()));
     $filter->setNoMatchFilter(new BoolNot(new Term(array("color" => "yellow"))));
     $query = new Query();
     $query->setPostFilter($filter);
     // search over the alias
     $index = $this->_getClient()->getIndex("indices_filter");
     $results = $index->search($query);
     // ensure that the proper docs have been filtered out for each index
     $this->assertEquals(5, $results->count());
     foreach ($results->getResults() as $result) {
         $data = $result->getData();
         $color = $data["color"];
         if ($result->getIndex() == $this->_index1->getName()) {
             $this->assertNotEquals("blue", $color);
         } else {
             $this->assertNotEquals("yellow", $color);
         }
     }
 }
开发者ID:tkaven,项目名称:Elastica,代码行数:21,代码来源:IndicesTest.php

示例7: 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

示例8: 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

示例9: testToArrayFromReference

 /**
  * @group unit
  */
 public function testToArrayFromReference()
 {
     $client = $this->_getClient();
     $index = new Index($client, 'test');
     $type = new Type($index, 'helloworld');
     $field = 'image';
     $query = new Image();
     $query->setFieldFeature($field, 'CEDD');
     $query->setFieldHash($field, 'BIT_SAMPLING');
     $query->setFieldBoost($field, 100);
     $query->setImageByReference($field, $index->getName(), $type->getName(), 10);
     $jsonString = '{"image":{"image":{"feature":"CEDD","hash":"BIT_SAMPLING","boost":100,"index":"test","type":"helloworld","id":10,"path":"image"}}}';
     $this->assertEquals($jsonString, json_encode($query->toArray()));
 }
开发者ID:JanJakes,项目名称:Elastica,代码行数:17,代码来源:ImageTest.php

示例10: getHealth

 /**
  * Get health information about the index
  * @return array Response data array
  */
 private function getHealth()
 {
     while (true) {
         $indexName = $this->index->getName();
         $path = "_cluster/health/{$indexName}";
         $response = $this->index->getClient()->request($path);
         if ($response->hasError()) {
             $this->error('Error fetching index health but going to retry.  Message: ' . $response->getError());
             sleep(1);
             continue;
         }
         return $response->getData();
     }
 }
开发者ID:zoglun,项目名称:mediawiki-extensions-CirrusSearch,代码行数:18,代码来源:Reindexer.php

示例11: __construct

 /**
  * @param Index $index
  * @param \ElasticaConnection $connection
  * @param Type[] $types
  * @param Type[] $oldTypes
  * @param int $shardCount
  * @param string $replicaCount
  * @param int $connectionTimeout
  * @param array $mergeSettings
  * @param array $mappingConfig
  * @param Maintenance $out
  */
 public function __construct(Index $index, \ElasticaConnection $connection, array $types, array $oldTypes, $shardCount, $replicaCount, $connectionTimeout, array $mergeSettings, array $mappingConfig, Maintenance $out = null)
 {
     // @todo: this constructor has too many arguments - refactor!
     $this->index = $index;
     $this->client = $this->index->getClient();
     $this->specificIndexName = $this->index->getName();
     $this->connection = $connection;
     $this->types = $types;
     $this->oldTypes = $oldTypes;
     $this->shardCount = $shardCount;
     $this->replicaCount = $replicaCount;
     $this->connectionTimeout = $connectionTimeout;
     $this->mergeSettings = $mergeSettings;
     $this->mappingConfig = $mappingConfig;
     $this->out = $out;
 }
开发者ID:jamesmontalvo3,项目名称:mediawiki-extensions-CirrusSearch,代码行数:28,代码来源:Reindexer.php

示例12: _waitForAllocation

 protected function _waitForAllocation(Index $index)
 {
     do {
         $state = $index->getClient()->getCluster()->getState();
         $indexState = $state['routing_table']['indices'][$index->getName()];
         $allocated = true;
         foreach ($indexState['shards'] as $shard) {
             if ($shard[0]['state'] != 'STARTED') {
                 $allocated = false;
             }
         }
     } while (!$allocated);
 }
开发者ID:vinusebastian,项目名称:Elastica,代码行数:13,代码来源:Base.php

示例13: __construct

 /**
  * Constructor.
  *
  * @param array $indexesByName
  * @param Index $defaultIndex
  */
 public function __construct(array $indexesByName, Index $defaultIndex)
 {
     $this->indexesByName = $indexesByName;
     $this->defaultIndexName = $defaultIndex->getName();
 }
开发者ID:r1pp3rj4ck,项目名称:FOSElasticaBundle,代码行数:11,代码来源:IndexManager.php

示例14: matchExistingDoc

 /**
  * Percolating an existing document
  *
  * @param  string $id
  * @param  string $type
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query Query to filter the percolator queries which
  *                                                                     are executed.
  * @param  array  $params
  * @return array With matching registered queries.
  */
 public function matchExistingDoc($id, $type, $query = null, $params = array())
 {
     $id = urlencode($id);
     $path = $this->_index->getName() . '/' . $type . '/' . $id . '/_percolate';
     return $this->_percolate($path, $query, array(), $params);
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:16,代码来源:Percolator.php


注:本文中的Elastica\Index::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。