本文整理汇总了PHP中Elastica\Type::getIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getIndex方法的具体用法?PHP Type::getIndex怎么用?PHP Type::getIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elastica\Type
的用法示例。
在下文中一共展示了Type::getIndex方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setType
/**
* @param string|\Elastica\Type $type
*
* @return $this
*/
public function setType($type)
{
if ($type instanceof Type) {
$this->setIndex($type->getIndex()->getName());
$type = $type->getName();
}
$this->_type = (string) $type;
return $this;
}
示例2: _addDocs
/**
* @param Type $type
* @param int $docs
*
* @return array
*/
private function _addDocs(Type $type, $docs)
{
$insert = array();
for ($i = 1; $i <= $docs; $i++) {
$insert[] = new Document($i, array('_id' => $i, 'key' => 'value'));
}
$type->addDocuments($insert);
$type->getIndex()->refresh();
return $insert;
}
示例3: deleteWarmers
private function deleteWarmers($warmers)
{
foreach (array_keys($warmers) as $name) {
$this->outputIndented("\tDeleting {$name}...");
$name = urlencode($name);
$path = "_warmer/{$name}";
$this->pageType->getIndex()->request($path, 'DELETE');
$this->output("done\n");
}
return Status::newGood();
}
示例4: setUp
protected function setUp()
{
$typeName = Cache::TYPE_NAME;
$this->type = $this->prophesize('\\Elastica\\Type');
$this->type->request(Argument::any(), Argument::cetera())->willReturn(true);
$this->type->getName()->willReturn($typeName);
$this->index = $this->prophesize('\\Elastica\\Index');
$this->index->getType($typeName)->willReturn($this->type->reveal());
$this->index->exists()->willReturn(true);
$nsDoc = new Document('DoctrineNamespaceCacheKey[]', [Cache::VALUE_FIELD => serialize($this->namespaceId)]);
$this->type->getIndex()->willReturn($this->index->reveal());
$this->type->getDocument("DoctrineNamespaceCacheKey[]")->willReturn($nsDoc);
$this->client = $this->prophesize('\\Elastica\\Client');
$this->client->getIndex($this->indexName)->willReturn($this->index->reveal());
$this->cache = new Cache($this->client->reveal(), ['index' => $this->indexName]);
}
示例5: setType
/**
* @param string|\Elastica\Type $type
* @return \Elastica\Bulk\Action
*/
public function setType($type)
{
if ($type instanceof Type) {
$this->setIndex($type->getIndex()->getName());
$type = $type->getName();
}
$this->_metadata['_type'] = $type;
return $this;
}
示例6: refresh
/**
*
*/
public function refresh()
{
$this->type->getIndex()->refresh(true);
}
示例7: indexingDatum
/**
* Construit les données afin que celles-ci soient indexées (avec les fields corrects)
* Méthode non testée et non utilisée pour le moment (Préférable de la tester avant..)
*
* @param CMbObject $datum the datum you want to construct
* @param Elastica\Type $type the type where you want to index the data
*
* @return array
*/
function indexingDatum($datum, $type)
{
$datum_to_index = $this->constructDatum($datum);
$document = $type->createDocument($datum['object_id'], $datum_to_index);
switch ($datum['type']) {
case 'create':
$type->addDocument($document);
break;
case 'store':
$type->updateDocument($document);
break;
case 'delete':
$type->deleteDocument($document);
break;
case 'merge':
//nothing to do
/*supprimer un des deux et faire un update de l'autre.*/
break;
default:
return false;
}
$type->getIndex()->refresh();
$this->deleteDatumTemporaryTable($datum['search_indexing_id']);
return true;
}