Class yii\elasticsearch\ActiveDataProvider
Inheritance | yii\elasticsearch\ActiveDataProvider » yii\data\ActiveDataProvider |
---|---|
Available since version | 2.0.5 |
ActiveDataProvider is an enhanced version of \yii\data\ActiveDataProvider specific to the ElasticSearch.
It allows to fetch not only rows and total rows count, but full query results including aggregations and so on.
Note: this data provider fetches result models and total count using single ElasticSearch query, so results total count will be fetched after pagination limit applying, which eliminates ability to verify if requested page number actually exist. Data provider disables \yii\elasticsearch\yii\data\Pagination::validatePage automatically because of this.
Public Methods
Method | Description | Defined By |
---|---|---|
getAggregation() | Returns results of the specified aggregation. | yii\elasticsearch\ActiveDataProvider |
getAggregations() | yii\elasticsearch\ActiveDataProvider | |
getQueryResults() | yii\elasticsearch\ActiveDataProvider | |
refresh() | yii\elasticsearch\ActiveDataProvider | |
setQueryResults() | yii\elasticsearch\ActiveDataProvider |
Protected Methods
Method | Description | Defined By |
---|---|---|
prepareKeys() | yii\elasticsearch\ActiveDataProvider | |
prepareModels() | yii\elasticsearch\ActiveDataProvider | |
prepareTotalCount() | yii\elasticsearch\ActiveDataProvider |
Method Details
Returns results of the specified aggregation.
public array getAggregation ( $name ) | ||
$name | string | Aggregation name. |
return | array | Aggregation results. |
---|---|---|
throws | \yii\base\InvalidCallException | if requested aggregation does not present in query results. |
public array getAggregations ( ) | ||
return | array | All aggregations results |
---|
public array getQueryResults ( ) | ||
return | array | Full query results |
---|
protected void prepareKeys ( $models ) | ||
$models |
protected void prepareModels ( ) |
protected void prepareTotalCount ( ) |
public void refresh ( ) |
public void setQueryResults ( $results ) | ||
$results | array | Full query results |