PHP 클래스 yii\elasticsearch\BatchQueryResult

You usually do not instantiate BatchQueryResult directly. Instead, you obtain it by calling [[Query::batch()]] or [[Query::each()]]. Because BatchQueryResult implements the [[\Iterator]] interface, you can iterate it to obtain a batch of data in each iteration. Batch size is determined by the [[Query::$limit]] setting. [[Query::$offset]] setting is ignored. New batches will be obtained until the server runs out of results. If [[Query::$orderBy]] parameter is not set, batches will be processed using the highly efficient "scan" mode. In this case, [[Query::$limit]] setting determines batch size per shard. See elasticsearch guide for more information. Example: php $query = (new Query)->from('user'); foreach ($query->batch() as $i => $users) { $users represents the rows in the $i-th batch } foreach ($query->each() as $user) { }
부터: 2.0.4
저자: Konstantin Sirotkin ([email protected])
상속: extends yii\base\Object, implements Iterator
파일 보기 프로젝트 열기: yiisoft/yii2-elasticsearch 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$db the DB connection to be used when performing batch query. If null, the elasticsearch application component will be used.
$each whether to return a single row during each iteration. If false, a whole batch of rows will be returned in each iteration.
$query the query object associated with this batch query. Do not modify this property directly unless after BatchQueryResult::reset is called explicitly.
$scrollWindow the amount of time to keep the scroll window open (in ElasticSearch time units.

공개 메소드들

메소드 설명
__destruct ( ) Destructor.
current ( ) : mixed Returns the current dataset.
key ( ) : integer Returns the index of the current dataset.
next ( ) Moves the internal pointer to the next dataset.
reset ( ) Resets the batch query.
rewind ( ) Resets the iterator to the initial state.
valid ( ) : boolean Returns whether there is a valid dataset at the current position.

보호된 메소드들

메소드 설명
fetchData ( ) : array Fetches the next batch of data.

메소드 상세

__destruct() 공개 메소드

Destructor.
public __destruct ( )

current() 공개 메소드

This method is required by the interface [[\Iterator]].
public current ( ) : mixed
리턴 mixed the current dataset.

fetchData() 보호된 메소드

Fetches the next batch of data.
protected fetchData ( ) : array
리턴 array the data fetched

key() 공개 메소드

This method is required by the interface [[\Iterator]].
public key ( ) : integer
리턴 integer the index of the current row.

next() 공개 메소드

This method is required by the interface [[\Iterator]].
public next ( )

reset() 공개 메소드

This method will clean up the existing batch query so that a new batch query can be performed.
public reset ( )

rewind() 공개 메소드

This method is required by the interface [[\Iterator]].
public rewind ( )

valid() 공개 메소드

This method is required by the interface [[\Iterator]].
public valid ( ) : boolean
리턴 boolean whether there is a valid dataset at the current position.

프로퍼티 상세

$db 공개적으로 프로퍼티

the DB connection to be used when performing batch query. If null, the elasticsearch application component will be used.
public $db

$each 공개적으로 프로퍼티

whether to return a single row during each iteration. If false, a whole batch of rows will be returned in each iteration.
public $each

$query 공개적으로 프로퍼티

the query object associated with this batch query. Do not modify this property directly unless after BatchQueryResult::reset is called explicitly.
public $query

$scrollWindow 공개적으로 프로퍼티

the amount of time to keep the scroll window open (in ElasticSearch time units.
public $scrollWindow