Skip to content

Commit e82cace

Browse files
author
Robert Lemke
committed
Merge pull request #18 from Flowpack/issue-17
[BUGFIX] Query execution broken with ES 1.0
2 parents 326c3d3 + fa4fc8c commit e82cace

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Eel/ElasticSearchQueryBuilder.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,14 @@ public function execute() {
359359
* we might be able to use https://github.com/elasticsearch/elasticsearch/issues/3300 as soon as it is merged.
360360
*/
361361
foreach ($hits['hits'] as $hit) {
362-
$node = $this->contextNode->getNode($hit['fields']['__path']);
362+
// with ElasticSearch 1.0 fields always returns an array,
363+
// see https://github.com/Flowpack/Flowpack.ElasticSearch.ContentRepositoryAdaptor/issues/17
364+
if (is_array($hit['fields']['__path'])) {
365+
$nodePath = current($hit['fields']['__path']);
366+
} else {
367+
$nodePath = $hit['fields']['__path'];
368+
}
369+
$node = $this->contextNode->getNode($nodePath);
363370
if ($node instanceof NodeInterface) {
364371
$nodes[$node->getIdentifier()] = $node;
365372
if ($this->limit > 0 && count($nodes) >= $this->limit) {

0 commit comments

Comments
 (0)