elastic-search
elastic-search copied to clipboard
Update query options failed after executing query
Bug: calling select()
, where()
etc on \Cake\ElasticSearch\Query
does not have any effect after executing all
because in \Cake\Datasource\QueryTrait::all()
its set to return previous results if available:
if ($this->_results !== null) {
return $this->_results;
}
But \Cake\ElasticSearch\Query
methods to change query options does not reset previous results like its done in \Cake\ORM\Query
by calling _dirty()
.
Code example:
$Query = $this->loadModel('Articles', 'Elastic')->find()->select(['id2']);
$Query->where(['id2'=>'0a3f509f']);
var_dump($Query->all()->toArray());
$Query->where(['id2'=>'0a3f50b2'], [], true);
var_dump($Query->all()->toArray());
Last call still returns record 0a3f509f
but have to return 0a3f50b2
instead.
Looks like we're missing behavior like Database\Query::_dirty()
provides ORM queries.
This issue is stale because it has been open for 120 days with no activity. Remove the stale
label or comment or this will be closed in 15 days
"closed this as completed" - its not completed