Skip to content

Commit dffa9d4

Browse files
committed
BUGFIX: Get the current document in the query result
With the change ElasticSearchQueryBuilder::query search only one lever under the current document. This behaviour is wrong. By example when you search from the site node, you search all the site, but not the homepage.
1 parent aea39eb commit dffa9d4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,16 @@ public function query(NodeInterface $contextNode)
777777
// on indexing, the __parentPath is tokenized to contain ALL parent path parts,
778778
// e.g. /foo, /foo/bar/, /foo/bar/baz; to speed up matching.. That's why we use a simple "term" filter here.
779779
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-term-filter.html
780-
$this->queryFilter('term', ['__parentPath' => $contextNode->getPath()]);
780+
$this->queryFilter('bool', [
781+
'should' => [
782+
[
783+
'term' => ['__parentPath' => $contextNode->getPath()]
784+
],
785+
[
786+
'term' => ['__path' => $contextNode->getPath()]
787+
]
788+
]
789+
]);
781790

782791
//
783792
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-terms-filter.html

0 commit comments

Comments
 (0)