Commit 3fb68096 by Carsten Brandt

add aggregation, stats and suggester to elasticsearch

fixes #4452, close #4452
parent 9dfca990
......@@ -11,6 +11,9 @@ Yii Framework 2 elasticsearch extension Change Log
- Enh #4048: Added `init` event to `ActiveQuery` classes (qiangxue)
- Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
- Enh: Make error messages more readable in HTML output (cebe)
- Enh: Added support for query stats (cebe)
- Enh: Added support for query suggesters (cebe)
- Chg #4451: Removed support for facets and replaced them with aggregations (cebe, tadaszelvys)
- Chg: asArray in ActiveQuery is now equal to using the normal Query. This means, that the output structure has changed and `with` is supported anymore. (cebe)
- Chg: Deletion of a record is now also considered successful if the record did not exist. (cebe)
- Chg: Requirement changes: Yii now requires elasticsearch version 1.0 or higher (cebe)
......
......@@ -98,19 +98,24 @@ class QueryBuilder extends \yii\base\Object
$parts['filter'] = $whereFilter;
}
if($query->highlight) {
if (!empty($query->highlight)) {
$parts['highlight'] = $query->highlight;
}
if (!empty($query->aggregations)) {
$parts['aggregations'] = $query->aggregations;
}
if (!empty($query->stats)) {
$parts['stats'] = $query->stats;
}
if (!empty($query->suggest)) {
$parts['suggest'] = $query->suggest;
}
$sort = $this->buildOrderBy($query->orderBy);
if (!empty($sort)) {
$parts['sort'] = $sort;
}
if (!empty($query->facets)) {
$parts['facets'] = $query->facets;
}
$options = [];
if ($query->timeout !== null) {
$options['timeout'] = $query->timeout;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment