Skip to content

Commit

Permalink
Merge pull request #4503 from neos/bugfix/4502-double-nodetypefilter
Browse files Browse the repository at this point in the history
BUGFIX: Don’t include subnodetypes of subnodetypes in node search
  • Loading branch information
dlubitz authored Aug 13, 2024
2 parents dd32a43 + 28f3c94 commit 2f2f625
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions Neos.Neos/Classes/Controller/Service/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Neos\Neos\View\Service\NodeJsonView;
use Neos\Neos\Service\Mapping\NodePropertyConverterService;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\NodeType;
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
use Neos\ContentRepository\Domain\Utility\NodePaths;

Expand Down Expand Up @@ -93,22 +92,9 @@ class NodesController extends ActionController
*/
public function indexAction($searchTerm = '', array $nodeIdentifiers = [], $workspaceName = 'live', array $dimensions = [], array $nodeTypes = ['Neos.Neos:Document'], NodeInterface $contextNode = null)
{
$searchableNodeTypeNames = [];
foreach ($nodeTypes as $nodeTypeName) {
if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
$this->throwStatus(400, sprintf('Unknown node type "%s"', $nodeTypeName));
}

$searchableNodeTypeNames[$nodeTypeName] = $nodeTypeName;
/** @var NodeType $subNodeType */
foreach ($this->nodeTypeManager->getSubNodeTypes($nodeTypeName, false) as $subNodeTypeName => $subNodeType) {
$searchableNodeTypeNames[$subNodeTypeName] = $subNodeTypeName;
}
}

$contentContext = $this->createContentContext($workspaceName, $dimensions);
if ($nodeIdentifiers === []) {
$nodes = $this->nodeSearchService->findByProperties($searchTerm, $searchableNodeTypeNames, $contentContext, $contextNode);
$nodes = $this->nodeSearchService->findByProperties($searchTerm, $nodeTypes, $contentContext, $contextNode);
} else {
$nodes = array_filter(
array_map(function ($identifier) use ($contentContext) {
Expand Down

0 comments on commit 2f2f625

Please sign in to comment.