Skip to content

Commit 7efed7b

Browse files
committed
BUGFIX: Skip content with hidden parent nodes in fulltext index
Relates: #214 #377
1 parent 6ce6aa9 commit 7efed7b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Classes/Indexer/NodeIndexer.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,16 @@ public function indexNode(NodeInterface $node, $targetWorkspaceName = null): voi
243243
}
244244
}
245245

246+
// Don't index node into fulltext if it has a hidden parent node that is not a fulltext root
247+
// Example: If a text node is in a hidden container element, it should not be indexed into the document
248+
$parentNode = $node;
249+
while (($parentNode = $parentNode->getParent())
250+
&& !$parentNode->getNodeType()->getConfiguration('search.fulltext.isRoot')) {
251+
if (!$parentNode->isVisible()) {
252+
return;
253+
}
254+
}
255+
246256
$documentIdentifier = $this->documentIdentifierGenerator->generate($node, $targetWorkspaceName);
247257
$nodeType = $node->getNodeType();
248258

0 commit comments

Comments
 (0)