diff --git a/lib/Container/Compiler/AsynchronousIndexingPass.php b/lib/Container/Compiler/AsynchronousIndexingPass.php index 118d7c10..012165bd 100644 --- a/lib/Container/Compiler/AsynchronousIndexingPass.php +++ b/lib/Container/Compiler/AsynchronousIndexingPass.php @@ -37,7 +37,7 @@ public function process(ContainerBuilder $container): void ->setDecoratedService(CoreContentEventSubscriber::class) ->setArguments([ new Reference('netgen.ibexa_search_extra.asynchronous_indexing.messenger.bus'), - new Reference('ibexa.api.service.location'), + new Reference('Ibexa\Contracts\Core\Persistence\Content\Location\Handler'), ]); $container diff --git a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php index 7177c672..b6e0ea85 100644 --- a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php +++ b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php @@ -12,7 +12,7 @@ use Ibexa\Contracts\Core\Repository\Events\Content\PublishVersionEvent; use Ibexa\Contracts\Core\Repository\Events\Content\RevealContentEvent; use Ibexa\Contracts\Core\Repository\Events\Content\UpdateContentMetadataEvent; -use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; +use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\CopyContent; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteTranslation; @@ -29,7 +29,7 @@ class ContentEventSubscriber implements EventSubscriberInterface private array $parentLocationIdsByContentId = []; public function __construct( private readonly MessageBusInterface $messageBus, - private readonly PersistenceHandler $persistenceHandler, + private readonly LocationHandler $locationHandler, ) {} @@ -59,10 +59,10 @@ public function onCopyContent(CopyContentEvent $event): void public function onBeforeDeleteContent(BeforeDeleteContentEvent $event): void { - $contentLocations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContentInfo()->id); + $contentLocations = $this->locationHandler->loadLocationsByContent($event->getContentInfo()->id); try { foreach ($contentLocations as $contentLocation){ - $this->parentLocationIdsByContentId[$event->getContentInfo()->id][] = $contentLocation->parentLocationId; + $this->parentLocationIdsByContentId[$event->getContentInfo()->id][] = $contentLocation->parentId; } } catch (Throwable) { // does nothing @@ -78,7 +78,7 @@ public function onDeleteContent(DeleteContentEvent $event): void $this->parentLocationIdsByContentId[$event->getContentInfo()->id] ?? [], ), ); - $this->parentLocationIdsByContentId = []; + unset($this->parentLocationIdsByContentId[$event->getContentInfo()->id]); } public function onDeleteTranslation(DeleteTranslationEvent $event): void diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php index b921294c..ebe6c64c 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php @@ -40,10 +40,9 @@ public function indexSingle(Location $location): void /** * @param \Ibexa\Contracts\Core\Persistence\Content\Location $location */ - public function indexSingleForDeleteContent(Location $location): void + public function indexSingleForParentLocation(Location $location): void { - $ancestor = $this->ancestorResolver->resolveAncestorForDeleteContent($location); - + $ancestor = $this->ancestorResolver->resolveAncestorForParentLocation($location); if ($ancestor === null) { return; } @@ -71,12 +70,12 @@ public function indexMultiple(array $locations): void /*** * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $locations */ - public function indexMultipleForDeleteContent(array $locations): void + public function indexMultipleForParentLocation(array $locations): void { $this->indexMultiple($locations); foreach ($locations as $location) { - $this->indexSingleForDeleteContent($location); + $this->indexSingleForParentLocation($location); } } } diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php index 9b22c413..c9b73be0 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php @@ -48,6 +48,6 @@ public function __invoke(DeleteContent $message): void ); } } - $this->ancestorIndexer->indexMultipleForDeleteContent($locations); + $this->ancestorIndexer->indexMultipleForParentLocation($locations); } } diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php index d0081923..516a403f 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php @@ -44,7 +44,7 @@ public function __invoke(MoveSubtree $message): void $message->oldParentLocationId, ); - $this->ancestorIndexer->indexSingle($location); + $this->ancestorIndexer->indexSingleForParentLocation($location); } catch (NotFoundException) { $this->logger->info( sprintf( diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php index c9ad8f92..1b008873 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php @@ -39,6 +39,6 @@ public function __invoke(Trash $message): void return; } - $this->ancestorIndexer->indexSingle($location); + $this->ancestorIndexer->indexSingleForParentLocation($location); } } diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php index 98154686..ada21fae 100644 --- a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php @@ -8,7 +8,7 @@ use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; -use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; +use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; @@ -19,10 +19,8 @@ use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler; use Ibexa\Contracts\Solr\FieldMapper\ContentTranslationFieldMapper; -use Ibexa\Core\Repository\Values\Content\Content; use function array_key_exists; use function array_keys; -use function array_map; use function array_merge; use function count; @@ -42,7 +40,7 @@ public function __construct( private readonly ContentTypeHandler $contentTypeHandler, private readonly ContentHandler $contentHandler, private readonly Handler $contentFilteringHandler, - private readonly PersistenceHandler $persistenceHandler, + private readonly LocationHandler $locationHandler, private readonly int $childrenLimit = 99, ) {} @@ -165,7 +163,7 @@ private function loadChildrenContentInfoList( $items = []; foreach ($contentItemList as $contentItem) { - $contentLocations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentItem->contentInfo->id); + $contentLocations = $this->locationHandler->loadLocationsByContent($contentItem->contentInfo->id); foreach ($contentLocations as $contentLocation) { if ( diff --git a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php index ffd47d0f..3e9ddcc1 100644 --- a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php +++ b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php @@ -63,7 +63,7 @@ public function resolveAncestor(Location $location): ?Location * * @param Location $location */ - public function resolveAncestorForDeleteContent(Location $location): ?Location + public function resolveAncestorForParentLocation(Location $location): ?Location { $contentTypeIdentifier = $this->getContentTypeIdentifier($location); diff --git a/lib/Resources/config/search/common/parent_child_indexing/common.yaml b/lib/Resources/config/search/common/parent_child_indexing/common.yaml index c0e54675..e7594e1f 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -7,7 +7,7 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' - - '@Ibexa\Contracts\Core\Persistence\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' tags: - { name: ibexa.search.solr.field.mapper.content.translation }