Skip to content

Commit 3dea925

Browse files
committed
FEATURE: Use new exclude configuration to filter nodes
1 parent be717bd commit 3dea925

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

Classes/Domain/Repository/NodeDataRepository.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Doctrine\ORM\EntityManagerInterface;
1919
use Doctrine\ORM\Internal\Hydration\IterableResult;
2020
use Doctrine\ORM\QueryBuilder;
21+
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Service\NodeTypeIndexingConfiguration;
2122
use Neos\ContentRepository\Domain\Model\NodeData;
2223
use Neos\Flow\Annotations as Flow;
2324
use Neos\Flow\Persistence\Repository;
@@ -29,6 +30,12 @@ class NodeDataRepository extends Repository
2930
{
3031
public const ENTITY_CLASSNAME = NodeData::class;
3132

33+
/**
34+
* @Flow\Inject
35+
* @var NodeTypeIndexingConfiguration
36+
*/
37+
protected $nodeTypeIndexingConfiguration;
38+
3239
/**
3340
* @Flow\Inject
3441
* @var EntityManagerInterface
@@ -40,15 +47,21 @@ class NodeDataRepository extends Repository
4047
* @param integer $firstResult
4148
* @param integer $maxResults
4249
* @return IterableResult
50+
* @throws \Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception
4351
*/
4452
public function findAllBySiteAndWorkspace($workspaceName, $firstResult = 0, $maxResults = 1000): IterableResult
4553
{
4654
/** @var QueryBuilder $queryBuilder */
4755
$queryBuilder = $this->entityManager->createQueryBuilder();
4856

57+
$excludedNodeTypes = array_keys(array_filter($this->nodeTypeIndexingConfiguration->getIndexableConfiguration(), static function($value) {
58+
return !$value;
59+
}));
60+
4961
$queryBuilder->select('n.Persistence_Object_Identifier persistenceObjectIdentifier, n.identifier identifier, n.dimensionValues dimensions, n.nodeType nodeType, n.path path')
5062
->from(NodeData::class, 'n')
51-
->where("n.workspace = :workspace AND n.removed = :removed AND n.movedTo IS NULL")
63+
->where('n.workspace = :workspace AND n.removed = :removed AND n.movedTo IS NULL')
64+
->andWhere($queryBuilder->expr()->notIn('n.nodeType', $excludedNodeTypes))
5265
->setFirstResult((integer)$firstResult)
5366
->setMaxResults((integer)$maxResults)
5467
->setParameters([

0 commit comments

Comments
 (0)