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


PHP Index::refresh方法代码示例

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


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

示例1: it_should_refresh

 /**
  * @test
  */
 public function it_should_refresh()
 {
     /**
      *
      * 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->refresh')->with(['index' => 'mock']);
     /**
      *
      * Assertion
      *
      */
     Index::refresh('mock');
 }
开发者ID:geekybeaver,项目名称:larasearch,代码行数:29,代码来源: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

示例3: testSetTypeFullText

 /**
  * Tests to add an Index to a Column with Type Fulltext
  */
 public function testSetTypeFullText()
 {
     // Create index
     $index = new Index();
     $index->TABLE_NAME = 'table2';
     $index->TABLE_SCHEMA = 'indextest';
     $index->INDEX_NAME = 'newname';
     $index->setType('FULLTEXT');
     // Add new column
     $columns = $index->columns;
     $col = new IndexColumn();
     $col->COLUMN_NAME = 'pk';
     $columns[] = $col;
     $col = new IndexColumn();
     $col->COLUMN_NAME = 'varchar';
     $col->SUB_PART = 10;
     $columns[] = $col;
     $index->columns = $columns;
     // Try saving
     $index->save();
     // Reload index and load index columns
     $index->refresh();
     $cols = IndexColumn::model()->findAllByAttributes(array('TABLE_SCHEMA' => $index->TABLE_SCHEMA, 'TABLE_NAME' => $index->TABLE_NAME, 'INDEX_NAME' => $index->INDEX_NAME));
     // Check properties
     $this->assertEquals('newname', $index->INDEX_NAME);
     $this->assertEquals('FULLTEXT', $index->getType());
 }
开发者ID:cebe,项目名称:chive,代码行数:30,代码来源:IndexTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("rescore_test");
     $this->_index->refresh();
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:6,代码来源:RescoreTest.php


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