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


PHP Index::clean方法代码示例

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


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

示例1: it_should_clean_old_indices

 /**
  * @test
  */
 public function it_should_clean_old_indices()
 {
     /**
      *
      * Set
      *
      * @var \Mockery\Mock $index
      * @var \Mockery\Mock $proxy
      * @var \Mockery\Mock $client
      */
     list($index, $proxy, $client) = $this->getMocks();
     // Mock the self::$client variable
     am::double('Iverberk\\Larasearch\\Index', ['self::$client' => $client]);
     /**
      *
      * Expectation
      *
      */
     $client->shouldReceive('indices->getAliases')->andReturn(['index_123456789101112' => ['aliases' => []]]);
     $client->shouldReceive('indices->delete')->with(['index' => 'index_123456789101112']);
     /**
      *
      * Assertion
      *
      */
     Index::clean('index');
 }
开发者ID:geekybeaver,项目名称:larasearch,代码行数:30,代码来源:IndexTest.php

示例2: reindex

 /**
  * @param bool     $relations
  * @param int      $batchSize
  * @param array    $mapping
  * @param callable $callback
  * @internal param bool $force
  * @internal param array $params
  */
 public function reindex($relations = false, $batchSize = 750, $mapping = [], callable $callback = null)
 {
     $model = $this->config['model'];
     $name = $this->config['index']->getName();
     $newName = $name . '_' . date("YmdHis");
     $relations = $relations ? Config::get('larasearch::paths.' . get_class($model)) : [];
     Index::clean($name);
     $index = App::make('iverberk.larasearch.index', array('name' => $newName, 'proxy' => $this));
     $index->create($mapping);
     if ($index->aliasExists($name)) {
         $index->import($model, $relations, $batchSize, $callback);
         $remove = [];
         foreach (Index::getAlias($name) as $index => $aliases) {
             $remove = ['remove' => ['index' => $index, 'alias' => $name]];
         }
         $add = ['add' => ['index' => $newName, 'alias' => $name]];
         $actions[] = array_merge($remove, $add);
         Index::updateAliases(['actions' => $actions]);
         Index::clean($name);
     } else {
         if ($this->config['index']->exists()) {
             $this->config['index']->delete();
         }
         $actions[] = ['add' => ['index' => $newName, 'alias' => $name]];
         Index::updateAliases(['actions' => $actions]);
         $index->import($model, $relations, $batchSize, $callback);
     }
     Index::refresh($name);
 }
开发者ID:geekybeaver,项目名称:larasearch,代码行数:37,代码来源:Proxy.php


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