Skip to content

Commit 4a7f016

Browse files
committed
TASK: Use findClosestFulltextRoot from abstract driver in ES5 driver
1 parent a53cc3c commit 4a7f016

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

Classes/Driver/AbstractIndexerDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function findClosestFulltextRoot(NodeInterface $node)
4848
if ($closestFulltextNode === null) {
4949
// root of hierarchy, no fulltext root found anymore, abort silently...
5050
if ($node->getPath() !== '/' && $node->getPath() !== '/sites') {
51-
$this->logger->log(sprintf('NodeIndexer: No fulltext root found for node %s (%s)', $node->getContextPath(), $node->getIdentifier()), LOG_WARNING, null, 'ElasticSearch (CR)');
51+
$this->logger->log(sprintf('NodeIndexer: No fulltext root found for node %s (%s)', $node->getIdentifier(), $node->getContextPath()), LOG_WARNING, null, 'ElasticSearch (CR)');
5252
}
5353

5454
return null;

Classes/Driver/Version5/IndexerDriver.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,9 @@ public function document($indexName, NodeInterface $node, ElasticSearchDocument
7777
*/
7878
public function fulltext(NodeInterface $node, array $fulltextIndexOfNode, $targetWorkspaceName = null)
7979
{
80-
$closestFulltextNode = $node;
81-
while (!$this->isFulltextRoot($closestFulltextNode)) {
82-
$closestFulltextNode = $closestFulltextNode->getParent();
83-
if ($closestFulltextNode === null) {
84-
// root of hierarchy, no fulltext root found anymore, abort silently...
85-
$this->logger->log(sprintf('NodeIndexer: No fulltext root found for node %s (%)', $node->getPath(), $node->getIdentifier()), LOG_WARNING, null, 'ElasticSearch (CR)');
86-
87-
return null;
88-
}
80+
$closestFulltextNode = $this->findClosestFulltextRoot($node);
81+
if ($closestFulltextNode === null) {
82+
return null;
8983
}
9084

9185
$closestFulltextNodeContextPath = $closestFulltextNode->getContextPath();

0 commit comments

Comments
 (0)