From 1783a9d77e7a482c25fcc09d80165ee44b100ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Fri, 22 Mar 2024 15:52:49 +0100 Subject: [PATCH 01/74] NGSTACK-836 parent child indexer --- bundle/DependencyInjection/Configuration.php | 12 + .../Compiler/AsynchronousIndexingPass.php | 1 + .../ContentEventSubscriber.php | 18 +- .../Message/Search/Content/DeleteContent.php | 2 +- .../ParentChildIndexing/AncestorIndexer.php | 82 ++++++ .../Content/CopyContentHandler.php | 26 ++ .../Content/DeleteContentHandler.php | 53 ++++ .../Content/DeleteTranslationHandler.php | 56 ++++ .../Content/HideContentHandler.php | 26 ++ .../Content/PublishVersionHandler.php | 27 ++ .../Content/RevealContentHandler.php | 26 ++ .../Content/UpdateContentMetadataHandler.php | 67 +++++ .../AssignSectionToSubtreeHandler.php | 44 +++ .../Location/CopySubtreeHandler.php | 44 +++ .../Location/CreateLocationHandler.php | 44 +++ .../Location/DeleteLocationHandler.php | 44 +++ .../Location/HideLocationHandler.php | 44 +++ .../Location/MoveSubtreeHandler.php | 58 ++++ .../Location/SwapLocationHandler.php | 48 +++ .../Location/UnhideLocationHandler.php | 44 +++ .../Location/UpdateLocationHandler.php | 42 +++ .../ObjectState/SetContentStateHandler.php | 26 ++ .../Section/AssignSectionHandler.php | 26 ++ .../Trash/RecoverHandler.php | 42 +++ .../Trash/TrashHandler.php | 44 +++ .../FieldMapper/FulltextFieldResolver.php | 72 +++++ .../FieldMapper/ParentChildFieldMapper.php | 185 ++++++++++++ .../ParentChildReindexAncestorResolver.php | 276 ++++++++++++++++++ lib/Resources/config/search/common.yaml | 1 + .../search/common/parent_child_indexing.yaml | 20 ++ .../common/parent_child_indexing/common.yaml | 29 ++ .../common/parent_child_indexing/content.yaml | 57 ++++ .../parent_child_indexing/location.yaml | 81 +++++ .../parent_child_indexing/object_state.yaml | 7 + .../common/parent_child_indexing/section.yaml | 7 + .../common/parent_child_indexing/trash.yaml | 18 ++ 36 files changed, 1690 insertions(+), 9 deletions(-) create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/CopyContentHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/HideContentHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/RevealContentHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/UpdateContentMetadataHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/AssignSectionToSubtreeHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CopySubtreeHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CreateLocationHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/DeleteLocationHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/HideLocationHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/SwapLocationHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UnhideLocationHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UpdateLocationHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/ObjectState/SetContentStateHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Section/AssignSectionHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/RecoverHandler.php create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php create mode 100644 lib/Core/Search/Solr/FieldMapper/FulltextFieldResolver.php create mode 100644 lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php create mode 100644 lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php create mode 100644 lib/Resources/config/search/common/parent_child_indexing.yaml create mode 100644 lib/Resources/config/search/common/parent_child_indexing/common.yaml create mode 100644 lib/Resources/config/search/common/parent_child_indexing/content.yaml create mode 100644 lib/Resources/config/search/common/parent_child_indexing/location.yaml create mode 100644 lib/Resources/config/search/common/parent_child_indexing/object_state.yaml create mode 100644 lib/Resources/config/search/common/parent_child_indexing/section.yaml create mode 100644 lib/Resources/config/search/common/parent_child_indexing/trash.yaml diff --git a/bundle/DependencyInjection/Configuration.php b/bundle/DependencyInjection/Configuration.php index 456d7b8e..61c9b663 100644 --- a/bundle/DependencyInjection/Configuration.php +++ b/bundle/DependencyInjection/Configuration.php @@ -31,6 +31,7 @@ public function getConfigTreeBuilder(): TreeBuilder $this->addFulltextBoostSection($rootNode); $this->addUsePageIndexingSection($rootNode); $this->addPageIndexingSection($rootNode); + $this->addParentChildIndexingSection($rootNode); return $treeBuilder; } @@ -249,4 +250,15 @@ private function addPageIndexingSection(ArrayNodeDefinition $nodeDefinition): vo ->end() ->end(); } + + private function addParentChildIndexingSection(ArrayNodeDefinition $nodeDefinition): void + { + $nodeDefinition + ->children() + ->booleanNode('use_parent_child_indexing') + ->info('Use parent child indexing') + ->defaultFalse() + ->end() + ->end(); + } } diff --git a/lib/Container/Compiler/AsynchronousIndexingPass.php b/lib/Container/Compiler/AsynchronousIndexingPass.php index 87852388..118d7c10 100644 --- a/lib/Container/Compiler/AsynchronousIndexingPass.php +++ b/lib/Container/Compiler/AsynchronousIndexingPass.php @@ -37,6 +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'), ]); $container diff --git a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php index 418ad801..6676b24a 100644 --- a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php +++ b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php @@ -12,6 +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\Repository\LocationService; 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; @@ -25,8 +26,11 @@ class ContentEventSubscriber implements EventSubscriberInterface { + private array $contentParentLocations = []; public function __construct( private readonly MessageBusInterface $messageBus, + private readonly LocationService $locationService, + ) {} public static function getSubscribedEvents(): array @@ -55,8 +59,11 @@ public function onCopyContent(CopyContentEvent $event): void public function onBeforeDeleteContent(BeforeDeleteContentEvent $event): void { + $contentLocations = $this->locationService->loadLocations($event->getContentInfo()); try { - $event->getContentInfo()->getMainLocation()?->parentLocationId; + foreach ($contentLocations as $contentLocation){ + $this->contentParentLocations[] = $contentLocation->parentLocationId; + } } catch (Throwable) { // does nothing } @@ -64,17 +71,12 @@ public function onBeforeDeleteContent(BeforeDeleteContentEvent $event): void public function onDeleteContent(DeleteContentEvent $event): void { - try { - $mainLocationParentLocationId = $event->getContentInfo()->getMainLocation()?->parentLocationId; - } catch (Throwable) { - $mainLocationParentLocationId = null; - } - + $parentLocationIds = $this->contentParentLocations ?? []; $this->messageBus->dispatch( new DeleteContent( $event->getContentInfo()->id, $event->getLocations(), - $mainLocationParentLocationId, + $parentLocationIds, ), ); } diff --git a/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php b/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php index f2d990c0..aff1ee3b 100644 --- a/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php +++ b/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php @@ -12,6 +12,6 @@ final class DeleteContent public function __construct( public readonly int $contentId, public readonly array $locationIds, - public readonly ?int $mainLocationParentLocationId, + public readonly ?array $parentLocationIds, ) {} } diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php new file mode 100644 index 00000000..b921294c --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php @@ -0,0 +1,82 @@ +ancestorResolver->resolveAncestor($location); + + + if ($ancestor === null) { + return; + } + + try { + $content = $this->contentHandler->load($ancestor->contentId); + } catch (NotFoundException) { + return; + } + + $this->searchHandler->indexContent($content); + $this->searchHandler->indexLocation($ancestor); + } + + /** + * @param \Ibexa\Contracts\Core\Persistence\Content\Location $location + */ + public function indexSingleForDeleteContent(Location $location): void + { + $ancestor = $this->ancestorResolver->resolveAncestorForDeleteContent($location); + + if ($ancestor === null) { + return; + } + + try { + $content = $this->contentHandler->load($ancestor->contentId); + } catch (NotFoundException) { + return; + } + + $this->searchHandler->indexContent($content); + $this->searchHandler->indexLocation($ancestor); + } + + /** + * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $locations + */ + public function indexMultiple(array $locations): void + { + foreach ($locations as $location) { + $this->indexSingle($location); + } + } + + /*** + * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $locations + */ + public function indexMultipleForDeleteContent(array $locations): void + { + $this->indexMultiple($locations); + + foreach ($locations as $location) { + $this->indexSingleForDeleteContent($location); + } + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/CopyContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/CopyContentHandler.php new file mode 100644 index 00000000..6be41995 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/CopyContentHandler.php @@ -0,0 +1,26 @@ +ancestorIndexer->indexMultiple( + $this->locationHandler->loadLocationsByContent( + $message->contentId, + ), + ); + } +} 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 new file mode 100644 index 00000000..9b22c413 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php @@ -0,0 +1,53 @@ +parentLocationIds === []) { + $this->logger->info( + sprintf( + '%s: Could not find main Location parent Location ID for deleted Content #%d, aborting', + $this::class, + $message->contentId, + ), + ); + + return; + } + $locations = []; + foreach ($message->parentLocationIds as $locationId) { + try { + $locations[] = $this->locationHandler->load($locationId); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $locationId, + ), + ); + } + } + $this->ancestorIndexer->indexMultipleForDeleteContent($locations); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php new file mode 100644 index 00000000..e8cfd393 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php @@ -0,0 +1,56 @@ +contentHandler->loadContentInfo( + $message->contentId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Content #%d is gone, aborting', + $this::class, + $message->contentId, + ), + ); + + return; + } + + if ($contentInfo->status !== ContentInfo::STATUS_PUBLISHED) { + return; + } + + $this->ancestorIndexer->indexMultiple( + $this->locationHandler->loadLocationsByContent( + $message->contentId, + ), + ); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/HideContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/HideContentHandler.php new file mode 100644 index 00000000..8b0233c4 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/HideContentHandler.php @@ -0,0 +1,26 @@ +ancestorIndexer->indexMultiple( + $this->locationHandler->loadLocationsByContent( + $message->contentId, + ), + ); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php new file mode 100644 index 00000000..5a27392e --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php @@ -0,0 +1,27 @@ +ancestorIndexer->indexMultiple( + $this->locationHandler->loadLocationsByContent( + $message->contentId, + ), + ); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/RevealContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/RevealContentHandler.php new file mode 100644 index 00000000..5c936f52 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/RevealContentHandler.php @@ -0,0 +1,26 @@ +ancestorIndexer->indexMultiple( + $this->locationHandler->loadLocationsByContent( + $message->contentId, + ), + ); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/UpdateContentMetadataHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/UpdateContentMetadataHandler.php new file mode 100644 index 00000000..c854297c --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/UpdateContentMetadataHandler.php @@ -0,0 +1,67 @@ +contentHandler->loadContentInfo( + $message->contentId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Content #%d is gone, aborting', + $this::class, + $message->contentId, + ), + ); + + return; + } + + if ($contentInfo->status !== ContentInfo::STATUS_PUBLISHED) { + return; + } + + try { + $location = $this->locationHandler->load( + $contentInfo->mainLocationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $contentInfo->mainLocationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/AssignSectionToSubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/AssignSectionToSubtreeHandler.php new file mode 100644 index 00000000..e9913bf2 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/AssignSectionToSubtreeHandler.php @@ -0,0 +1,44 @@ +locationHandler->load( + $message->locationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CopySubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CopySubtreeHandler.php new file mode 100644 index 00000000..fd4694ac --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CopySubtreeHandler.php @@ -0,0 +1,44 @@ +locationHandler->load( + $message->locationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CreateLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CreateLocationHandler.php new file mode 100644 index 00000000..00e4f3f3 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CreateLocationHandler.php @@ -0,0 +1,44 @@ +locationHandler->load( + $message->locationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/DeleteLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/DeleteLocationHandler.php new file mode 100644 index 00000000..300fd175 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/DeleteLocationHandler.php @@ -0,0 +1,44 @@ +locationHandler->load( + $message->parentLocationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->parentLocationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/HideLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/HideLocationHandler.php new file mode 100644 index 00000000..e4f08810 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/HideLocationHandler.php @@ -0,0 +1,44 @@ +locationHandler->load( + $message->locationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} 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 new file mode 100644 index 00000000..d0081923 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php @@ -0,0 +1,58 @@ +locationHandler->load( + $message->locationId, + ); + + $this->ancestorIndexer->indexSingle($location); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + } + + try { + $location = $this->locationHandler->load( + $message->oldParentLocationId, + ); + + $this->ancestorIndexer->indexSingle($location); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Old parent Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + } + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/SwapLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/SwapLocationHandler.php new file mode 100644 index 00000000..ae039193 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/SwapLocationHandler.php @@ -0,0 +1,48 @@ +reindexForLocation($message->location1Id); + $this->reindexForLocation($message->location2Id); + } + + private function reindexForLocation(int $locationId): void + { + try { + $location = $this->locationHandler->load($locationId); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UnhideLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UnhideLocationHandler.php new file mode 100644 index 00000000..69dc00c9 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UnhideLocationHandler.php @@ -0,0 +1,44 @@ +locationHandler->load( + $message->locationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UpdateLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UpdateLocationHandler.php new file mode 100644 index 00000000..92a76f98 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UpdateLocationHandler.php @@ -0,0 +1,42 @@ +locationHandler->load($message->locationId); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/ObjectState/SetContentStateHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/ObjectState/SetContentStateHandler.php new file mode 100644 index 00000000..bee8711b --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/ObjectState/SetContentStateHandler.php @@ -0,0 +1,26 @@ +ancestorIndexer->indexMultiple( + $this->locationHandler->loadLocationsByContent( + $message->contentId, + ), + ); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Section/AssignSectionHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Section/AssignSectionHandler.php new file mode 100644 index 00000000..df1ad48b --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Section/AssignSectionHandler.php @@ -0,0 +1,26 @@ +ancestorIndexer->indexMultiple( + $this->locationHandler->loadLocationsByContent( + $message->contentId, + ), + ); + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/RecoverHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/RecoverHandler.php new file mode 100644 index 00000000..93f49e73 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/RecoverHandler.php @@ -0,0 +1,42 @@ +locationHandler->load($message->locationId); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->locationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} 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 new file mode 100644 index 00000000..c9ad8f92 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php @@ -0,0 +1,44 @@ +locationHandler->load( + $message->parentLocationId, + ); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $message->parentLocationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingle($location); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/FulltextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/FulltextFieldResolver.php new file mode 100644 index 00000000..21ddfec3 --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/FulltextFieldResolver.php @@ -0,0 +1,72 @@ +versionInfo->contentInfo->contentTypeId; + $contentType = $this->contentTypeHandler->load($contentTypeId); + } catch (NotFoundException) { + return $fields; + } + + foreach ($content->fields as $field) { + if ($field->languageCode !== $languageCode) { + continue; + } + + foreach ($contentType->fieldDefinitions as $fieldDefinition) { + if (!$fieldDefinition->isSearchable) { + continue; + } + + if ($fieldDefinition->id !== $field->fieldDefinitionId) { + continue; + } + + $fieldType = $this->fieldRegistry->getType($field->type); + $indexFields = $fieldType->getIndexData($field, $fieldDefinition); + + foreach ($indexFields as $indexField) { + if ($indexField->value === null) { + continue; + } + + if (!$indexField->getType() instanceof FullTextField) { + continue; + } + + $fields[] = new Field( + 'meta_content__text', + (string) $indexField->value, + new TextField(), + ); + } + } + } + return $fields; + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php new file mode 100644 index 00000000..eac82bf3 --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php @@ -0,0 +1,185 @@ + + */ + private array $contentTypeIdIdentifierCache; + + /** + * @param array $configuration + */ + public function __construct( + private readonly array $configuration, + private readonly FulltextFieldResolver $fulltextFieldResolver, + private readonly ContentTypeHandler $contentTypeHandler, + private readonly ContentHandler $contentHandler, + private readonly LocationHandler $locationHandler, + private readonly Handler $searchHandler, + private readonly int $childrenLimit = 99, + ) {} + + public function accept(SPIContent $content, $languageCode): bool + { + $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; + $contentType = $this->contentTypeHandler->load($contentTypeId); + $contentTypeIdentifier = $contentType->identifier; + + return array_key_exists($contentTypeIdentifier, $this->configuration); + } + + /** + * @param string $languageCode + * + * @return \Ibexa\Contracts\Core\Search\Field[] + */ + public function mapFields(SPIContent $content, $languageCode): array + { + $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; + $contentType = $this->contentTypeHandler->load($contentTypeId); + $contentTypeIdentifier = $contentType->identifier; + + return $this->recursiveMapFields( + $content->versionInfo->contentInfo, + $languageCode, + $this->configuration[$contentTypeIdentifier], + false, + ); + } + + /** + * @param array $configuration + * + * @return \Ibexa\Contracts\Core\Search\Field[] + */ + private function recursiveMapFields( + ContentInfo $contentInfo, + string $languageCode, + ?array $configuration, + bool $doIndex = true, + ): array { + $fieldsGrouped = [[]]; + $isIndexed = !isset($configuration['indexed']) || (bool) $configuration['indexed']; + $childrenConfiguration = $configuration['children'] ?? []; + + if ($isIndexed && $doIndex) { + $content = $this->contentHandler->load($contentInfo->id); + $fieldsGrouped[] = $this->fulltextFieldResolver->resolveFields($content, $languageCode); + } + + $childrenContentInfoList = $this->loadChildrenContentInfoList( + $contentInfo, + $languageCode, + $childrenConfiguration, + ); + + foreach ($childrenContentInfoList as $childContentInfo) { + $contentTypeId = $childContentInfo->contentTypeId; + $contentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); + $childConfiguration = $childrenConfiguration[$contentTypeIdentifier] ?? null; + + if ($childConfiguration === null) { + continue; + } + + $fieldsGrouped[] = $this->recursiveMapFields( + $childContentInfo, + $languageCode, + $childConfiguration, + ); + } + return array_merge(...$fieldsGrouped); + } + + private function getContentTypeIdentifier(int $contentTypeId): ?string + { + if (isset($this->contentTypeIdIdentifierCache[$contentTypeId])) { + return $this->contentTypeIdIdentifierCache[$contentTypeId]; + } + + try { + $contentType = $this->contentTypeHandler->load($contentTypeId); + $identifier = $contentType->identifier; + } catch (NotFoundException) { + $identifier = null; + } + + $this->contentTypeIdIdentifierCache[$contentTypeId] = $identifier; + + return $identifier; + } + + /** + * @param array $configuration + * + * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] + */ + private function loadChildrenContentInfoList( + ContentInfo $contentInfo, + string $languageCode, + array $configuration, + ): array { + $contentTypeIdentifiers = array_keys($configuration); + + if (count($contentTypeIdentifiers) === 0) { + return []; + } + + $searchResult = $this->searchHandler->findContent( + new Query([ + 'filter' => new LocationQueryCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($contentTypeIdentifiers), + new ParentLocationId($contentInfo->mainLocationId), + new Visible(true), + ]), + ), + 'limit' => $this->childrenLimit, + ]), + [ + 'languages' => [ + $languageCode, + ], + ], + ); + + /** @var \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] $result */ + $result = array_map( + static fn (SearchHit $searchHit) => $searchHit->valueObject, + $searchResult->searchHits, + ); + + return $result; + } +} diff --git a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php new file mode 100644 index 00000000..ffd47d0f --- /dev/null +++ b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php @@ -0,0 +1,276 @@ + + */ + private array $contentIdContentTypeIdentifierCache = []; + + /** + * @param array $configuration + */ + public function __construct( + private readonly ContentHandler $contentHandler, + private readonly ContentTypeHandler $contentTypeHandler, + private readonly LocationHandler $locationHandler, + private readonly array $configuration, + ) {} + + public function resolveAncestor(Location $location): ?Location + { + $ancestry = [$location]; + + do { + $match = $this->matchPath($ancestry); + + if ($match === 0) { + return end($ancestry); + } + } while (is_int($match) && $this->addToAncestry($ancestry)); + + return null; + } + + /** + * Return the location if its content type matches the path parent + * + * @param Location $location + */ + public function resolveAncestorForDeleteContent(Location $location): ?Location + { + $contentTypeIdentifier = $this->getContentTypeIdentifier($location); + + foreach ($this->getPaths() as $path) { + if (str_ends_with($path, $contentTypeIdentifier)) { + return $location; + } + } + + return null; + } + + /** + * Return remaining string length if the path matches (if zero, the match is complete), false otherwise. + * + * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $ancestry + */ + private function matchPath(array $ancestry): false|int + { + $ancestryPath = $this->getAncestryPath($ancestry); + if ($ancestryPath === null) { + return false; + } + foreach ($this->getPaths() as $path) { + if (str_starts_with($path, $ancestryPath)) { + return mb_strlen($path) - mb_strlen($ancestryPath); + } + } + + return false; + } + + /** + * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $ancestry + */ + private function getAncestryPath(array $ancestry): ?string + { + $pathElements = []; + + foreach ($ancestry as $location) { + try { + $pathElements[] = $this->getContentTypeIdentifier($location); + } catch (NotFoundException) { + return null; + } + } + + return implode('/', $pathElements); + } + + /** + * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $ancestry + */ + private function addToAncestry(array &$ancestry): bool + { + /** @var \Ibexa\Contracts\Core\Persistence\Content\Location $last */ + $last = end($ancestry); + + if ($last->depth <= 1) { + return false; + } + + try { + $ancestry[] = $this->getParentLocation($last); + } catch (NotFoundException) { + return false; + } + + return true; + } + + private function getParentLocation(Location $location): Location + { + return $this->locationHandler->load($location->parentId); + } + + private function getContentTypeIdentifier(Location $location): string + { + /** @var int $contentId */ + $contentId = $location->contentId; + + if (!isset($this->contentIdContentTypeIdentifierCache[$contentId])) { + $contentInfo = $this->contentHandler->loadContentInfo($contentId); + $contentTypeId = $contentInfo->contentTypeId; + $contentType = $this->contentTypeHandler->load($contentTypeId); + + $this->contentIdContentTypeIdentifierCache[$contentId] = $contentType->identifier; + } + + return $this->contentIdContentTypeIdentifierCache[$contentId]; + } + + /** + * @return string[] + */ + private function getPaths(): array + { + if ($this->paths === null) { + $normalizedConfiguration = $this->normalizeConfiguration($this->configuration); + $paths = $this->recursiveFlattenPaths($normalizedConfiguration); + $this->paths = $this->expandPaths($paths); + } + + return $this->paths; + } + + /** + * @param string[] $paths + * + * @return string[] + */ + private function expandPaths(array $paths): array + { + $expandedPathsGrouped = [[]]; + + foreach ($paths as $path) { + $expandedPathsGrouped[] = $this->recursiveExpandPath(explode('/', $path)); + } + + return array_merge(...$expandedPathsGrouped); + } + + /** + * @param string[] $pathElements + * + * @return string[] + */ + private function recursiveExpandPath(array $pathElements): array + { + $expandedPaths = []; + + if (count($pathElements) > 1) { + $path = implode('/', $pathElements); + array_shift($pathElements); + + $expandedPaths = [ + $path, + ...$expandedPaths, + ...$this->recursiveExpandPath($pathElements), + ]; + } + + return $expandedPaths; + } + + /** + * @param array $config + * + * @return string[] + */ + private function recursiveFlattenPaths(array $config, string $path = ''): array + { + $paths = []; + + foreach ($config as $key => $value) { + if (is_array($value) && count($value) > 0) { + $paths = [ + ...$paths, + ...$this->recursiveFlattenPaths($value, '/' . $key . $path), + ]; + + continue; + } + + $paths[] = $key . $path; + } + + return $paths; + } + + /** + * @param array $config + * + * @return array + */ + private function normalizeConfiguration(array $config): array + { + $normalizedConfig = []; + + foreach ($config as $key => $value) { + $normalizedConfig[$key] = $this->recursiveNormalizeConfiguration($value); + } + + return $normalizedConfig; + } + + /** + * @param array $config + * + * @return array + */ + private function recursiveNormalizeConfiguration(array $config): array + { + $normalizedConfig = []; + + foreach ($config as $key => $value) { + if ($key === 'indexed') { + continue; + } + + if ($key === 'children') { + return $this->recursiveNormalizeConfiguration($value); + } + + $normalizedConfig[$key] = $this->recursiveNormalizeConfiguration($value); + } + + return $normalizedConfig; + } +} diff --git a/lib/Resources/config/search/common.yaml b/lib/Resources/config/search/common.yaml index 90f15b55..18914fff 100644 --- a/lib/Resources/config/search/common.yaml +++ b/lib/Resources/config/search/common.yaml @@ -2,6 +2,7 @@ imports: - { resource: common/asynchronous_indexing.yaml } - { resource: common/field_value_mappers.yaml } - { resource: common/page_indexing.yaml } + - { resource: common/parent_child_indexing.yaml } services: netgen.ibexa_search_extra.fulltext.configured_factory: diff --git a/lib/Resources/config/search/common/parent_child_indexing.yaml b/lib/Resources/config/search/common/parent_child_indexing.yaml new file mode 100644 index 00000000..57f0527f --- /dev/null +++ b/lib/Resources/config/search/common/parent_child_indexing.yaml @@ -0,0 +1,20 @@ +imports: + - { resource: parent_child_indexing/common.yaml } + - { resource: parent_child_indexing/content.yaml } + - { resource: parent_child_indexing/location.yaml } + - { resource: parent_child_indexing/object_state.yaml } + - { resource: parent_child_indexing/section.yaml } + - { resource: parent_child_indexing/trash.yaml } + +parameters: + netgen.ibexa_search_extra.parent_child_indexer: + parent_content: + children: + child_content: + indexed: true + children: + child_content: + indexed: true + children: + child_content: + indexed: true \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing/common.yaml b/lib/Resources/config/search/common/parent_child_indexing/common.yaml new file mode 100644 index 00000000..c041d921 --- /dev/null +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -0,0 +1,29 @@ +services: + Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ParentChildFieldMapper: + arguments: + $configuration: '%netgen.ibexa_search_extra.parent_child_indexer%' + $fulltextFieldResolver: '@Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FulltextFieldResolver' + $contentTypeHandler: '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + $contentHandler: '@Ibexa\Contracts\Core\Persistence\Content\Handler' + $locationHandler: '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + $searchHandler: '@Ibexa\Core\Search\Legacy\Content\Handler' + tags: + - { name: ibexa.search.solr.field.mapper.content.translation } + + Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver: + arguments: + $contentHandler: '@Ibexa\Core\Persistence\Legacy\Content\Handler' + $contentTypeHandler: '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + $locationHandler: '@Ibexa\Core\Persistence\Cache\LocationHandler' + $configuration: '%netgen.ibexa_search_extra.parent_child_indexer%' + + Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FulltextFieldResolver: + arguments: + $contentTypeHandler: '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + $fieldRegistry: '@Ibexa\Core\Search\Common\FieldRegistry' + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer: + arguments: + $searchHandler: '@Ibexa\Contracts\Core\Search\VersatileHandler' + $contentHandler: '@Ibexa\Core\Persistence\Legacy\Content\Handler' + $ancestorResolver: '@Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver' \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing/content.yaml b/lib/Resources/config/search/common/parent_child_indexing/content.yaml new file mode 100644 index 00000000..5ca774a5 --- /dev/null +++ b/lib/Resources/config/search/common/parent_child_indexing/content.yaml @@ -0,0 +1,57 @@ +services: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing/location.yaml b/lib/Resources/config/search/common/parent_child_indexing/location.yaml new file mode 100644 index 00000000..b151f3fb --- /dev/null +++ b/lib/Resources/config/search/common/parent_child_indexing/location.yaml @@ -0,0 +1,81 @@ +services: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml new file mode 100644 index 00000000..8d403ad3 --- /dev/null +++ b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml @@ -0,0 +1,7 @@ +services: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + tags: + - { name: messenger.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/section.yaml b/lib/Resources/config/search/common/parent_child_indexing/section.yaml new file mode 100644 index 00000000..a88d77dd --- /dev/null +++ b/lib/Resources/config/search/common/parent_child_indexing/section.yaml @@ -0,0 +1,7 @@ +services: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + tags: + - { name: messenger.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml new file mode 100644 index 00000000..d709f57a --- /dev/null +++ b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml @@ -0,0 +1,18 @@ +services: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler: + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@?logger' + tags: + - { name: messenger.message_handler } + - { name: monolog.logger, channel: ngsearchextra } From 2cc0138cb77b83397616824969978dc16fece2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Mon, 25 Mar 2024 12:48:02 +0100 Subject: [PATCH 02/74] NGSTACK-836 remove SearchResultExtractorTrait from ParentChildFieldMapper --- lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php index eac82bf3..de40bfa0 100644 --- a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php @@ -7,7 +7,6 @@ use Ibexa\Contracts\Core\Persistence\Content as SPIContent; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; -use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\Query; @@ -19,7 +18,6 @@ use Ibexa\Core\Search\Legacy\Content\Handler; use Netgen\IbexaSearchExtra\API\Values\Content\Query\Criterion\LocationQuery as LocationQueryCriterion; use Netgen\IbexaSearchExtra\API\Values\Content\Query\Criterion\Visible; -use Netgen\IbexaSiteApi\Core\Traits\SearchResultExtractorTrait; use function array_key_exists; @@ -30,8 +28,6 @@ final class ParentChildFieldMapper extends ContentTranslationFieldMapper { - use SearchResultExtractorTrait; - /** * @var array */ @@ -45,7 +41,6 @@ public function __construct( private readonly FulltextFieldResolver $fulltextFieldResolver, private readonly ContentTypeHandler $contentTypeHandler, private readonly ContentHandler $contentHandler, - private readonly LocationHandler $locationHandler, private readonly Handler $searchHandler, private readonly int $childrenLimit = 99, ) {} From d8c149eb5d42013b9990c97b25d5b809740b8de4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Mon, 25 Mar 2024 14:14:08 +0100 Subject: [PATCH 03/74] NGSTACK-836 remove argument from service definition --- .../config/search/common/parent_child_indexing/common.yaml | 1 - 1 file changed, 1 deletion(-) 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 c041d921..4db5c24d 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -5,7 +5,6 @@ services: $fulltextFieldResolver: '@Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FulltextFieldResolver' $contentTypeHandler: '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' $contentHandler: '@Ibexa\Contracts\Core\Persistence\Content\Handler' - $locationHandler: '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' $searchHandler: '@Ibexa\Core\Search\Legacy\Content\Handler' tags: - { name: ibexa.search.solr.field.mapper.content.translation } From b02d9efead42a86f807f209d9fe5ec0ac96617e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Mon, 25 Mar 2024 16:08:27 +0100 Subject: [PATCH 04/74] NGSTACK-836 add parent child indexing compiler pass --- .../NetgenIbexaSearchExtraExtension.php | 9 ++++++ bundle/NetgenIbexaSearchExtraBundle.php | 2 ++ .../Compiler/ParentChildIndexingPass.php | 31 +++++++++++++++++++ .../search/common/parent_child_indexing.yaml | 12 +------ .../common/parent_child_indexing/content.yaml | 14 ++++----- .../parent_child_indexing/location.yaml | 18 +++++------ .../parent_child_indexing/object_state.yaml | 2 +- .../common/parent_child_indexing/section.yaml | 2 +- .../common/parent_child_indexing/trash.yaml | 4 +-- 9 files changed, 63 insertions(+), 31 deletions(-) create mode 100644 lib/Container/Compiler/ParentChildIndexingPass.php diff --git a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php index 3b68f079..5fdb830c 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -94,6 +94,7 @@ private function processExtensionConfiguration(array $configs, ContainerBuilder $this->processFullTextBoostConfiguration($configuration, $container); $this->processUsePageIndexingConfiguration($configuration, $container); $this->processPageIndexingConfiguration($configuration, $container); + $this->processParentChildIndexingConfiguration($configuration, $container); } private function processSearchResultExtractorConfiguration(array $configuration, ContainerBuilder $container): void @@ -157,4 +158,12 @@ private function processPageIndexingConfiguration(array $configuration, Containe $configuration['page_indexing']['enabled'] ?? false, ); } + + private function processParentChildIndexingConfiguration(array $configuration, ContainerBuilder $container): void + { + $container->setParameter( + 'netgen_ibexa_search_extra.use_parent_child_indexing', + $configuration['use_parent_child_indexing'], + ); + } } diff --git a/bundle/NetgenIbexaSearchExtraBundle.php b/bundle/NetgenIbexaSearchExtraBundle.php index 6c9022dc..f6c64d2a 100644 --- a/bundle/NetgenIbexaSearchExtraBundle.php +++ b/bundle/NetgenIbexaSearchExtraBundle.php @@ -5,6 +5,7 @@ namespace Netgen\Bundle\IbexaSearchExtraBundle; use Netgen\IbexaSearchExtra\Container\Compiler; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -21,6 +22,7 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass()); $container->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass()); $container->addCompilerPass(new Compiler\AsynchronousIndexingPass()); + $container->addCompilerPass(new Compiler\ParentChildIndexingPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 100); $container->addCompilerPass(new Compiler\FieldType\RichTextIndexablePass()); $container->addCompilerPass(new Compiler\SearchResultExtractorPass()); $container->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass()); diff --git a/lib/Container/Compiler/ParentChildIndexingPass.php b/lib/Container/Compiler/ParentChildIndexingPass.php new file mode 100644 index 00000000..0eaeaac5 --- /dev/null +++ b/lib/Container/Compiler/ParentChildIndexingPass.php @@ -0,0 +1,31 @@ +getParameter( + 'netgen_ibexa_search_extra.use_parent_child_indexing', + ); + + if ($useParentChildIndexing !== true) { + return; + } + + $serviceIds =$container->findTaggedServiceIds(self::ParentChildIndexerTag); + + foreach ($serviceIds as $serviceId => $tag) { + $definition = $container->getDefinition($serviceId); + $definition->addTag(self::MessageHandlerTag); + } + + } +} \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing.yaml b/lib/Resources/config/search/common/parent_child_indexing.yaml index 57f0527f..21e72909 100644 --- a/lib/Resources/config/search/common/parent_child_indexing.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing.yaml @@ -7,14 +7,4 @@ imports: - { resource: parent_child_indexing/trash.yaml } parameters: - netgen.ibexa_search_extra.parent_child_indexer: - parent_content: - children: - child_content: - indexed: true - children: - child_content: - indexed: true - children: - child_content: - indexed: true \ No newline at end of file + netgen.ibexa_search_extra.parent_child_indexer: [] \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing/content.yaml b/lib/Resources/config/search/common/parent_child_indexing/content.yaml index 5ca774a5..c24982db 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/content.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/content.yaml @@ -4,7 +4,7 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler: arguments: @@ -12,7 +12,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler: @@ -22,7 +22,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler: @@ -30,21 +30,21 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler: arguments: @@ -53,5 +53,5 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing/location.yaml b/lib/Resources/config/search/common/parent_child_indexing/location.yaml index b151f3fb..6d2c81ea 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/location.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/location.yaml @@ -5,7 +5,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler: @@ -14,7 +14,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler: @@ -23,7 +23,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler: @@ -32,7 +32,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler: @@ -41,7 +41,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler: @@ -50,7 +50,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler: @@ -59,7 +59,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler: @@ -68,7 +68,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler: @@ -77,5 +77,5 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } \ No newline at end of file diff --git a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml index 8d403ad3..2f95e29b 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml @@ -4,4 +4,4 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/section.yaml b/lib/Resources/config/search/common/parent_child_indexing/section.yaml index a88d77dd..e5c3c88e 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/section.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/section.yaml @@ -4,4 +4,4 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml index d709f57a..5c5fd683 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml @@ -5,7 +5,7 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler: @@ -14,5 +14,5 @@ services: - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' - '@?logger' tags: - - { name: messenger.message_handler } + - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } From 1f155f1ddb7528371c9ecc8ac3b3afd647f8be2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 28 Mar 2024 11:28:58 +0100 Subject: [PATCH 05/74] NGSTACK-836 service definition changes --- .../common/parent_child_indexing/common.yaml | 47 +++++++++++------- .../common/parent_child_indexing/content.yaml | 40 ++++++++++------ .../parent_child_indexing/location.yaml | 48 +++++++++++-------- .../parent_child_indexing/object_state.yaml | 5 +- .../common/parent_child_indexing/section.yaml | 5 +- .../common/parent_child_indexing/trash.yaml | 10 ++-- 6 files changed, 96 insertions(+), 59 deletions(-) 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 4db5c24d..c0e54675 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -1,28 +1,39 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ParentChildFieldMapper: + netgen_search_extra.parent_child_indexing.parent_child_field_mapper: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ParentChildFieldMapper arguments: - $configuration: '%netgen.ibexa_search_extra.parent_child_indexer%' - $fulltextFieldResolver: '@Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FulltextFieldResolver' - $contentTypeHandler: '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - $contentHandler: '@Ibexa\Contracts\Core\Persistence\Content\Handler' - $searchHandler: '@Ibexa\Core\Search\Legacy\Content\Handler' + - '%netgen.ibexa_search_extra.parent_child_indexer%' + - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' + - '@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' tags: - { name: ibexa.search.solr.field.mapper.content.translation } - Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver: + + netgen_search_extra.parent_child_indexing.parent_child_reindex_ancestor_resolver: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver arguments: - $contentHandler: '@Ibexa\Core\Persistence\Legacy\Content\Handler' - $contentTypeHandler: '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - $locationHandler: '@Ibexa\Core\Persistence\Cache\LocationHandler' - $configuration: '%netgen.ibexa_search_extra.parent_child_indexer%' + - '@Ibexa\Core\Persistence\Legacy\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + - '@Ibexa\Core\Persistence\Cache\LocationHandler' + - '%netgen.ibexa_search_extra.parent_child_indexer%' + - Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FulltextFieldResolver: + netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FullTextFieldResolver\NativeFulltextFieldResolver arguments: - $contentTypeHandler: '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - $fieldRegistry: '@Ibexa\Core\Search\Common\FieldRegistry' + - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + - '@Ibexa\Core\Search\Common\FieldRegistry' - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer: + netgen_search_extra.parent_child_indexing.fulltext_field_resolver: + alias: netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native + + netgen_search_extra.parent_child_indexing.ancestor_indexer: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer arguments: - $searchHandler: '@Ibexa\Contracts\Core\Search\VersatileHandler' - $contentHandler: '@Ibexa\Core\Persistence\Legacy\Content\Handler' - $ancestorResolver: '@Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver' \ No newline at end of file + - '@Ibexa\Contracts\Core\Search\VersatileHandler' + - '@Ibexa\Core\Persistence\Legacy\Content\Handler' + - '@netgen_search_extra.parent_child_indexing.parent_child_reindex_ancestor_resolver' + diff --git a/lib/Resources/config/search/common/parent_child_indexing/content.yaml b/lib/Resources/config/search/common/parent_child_indexing/content.yaml index c24982db..e0f09b89 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/content.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/content.yaml @@ -1,56 +1,68 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler: + netgen_search_extra.parent_child_indexing.copy_content_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: netgen.parent_child_indexer.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler: + + netgen_search_extra.parent_child_indexing.delete_content_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler: + netgen_search_extra.parent_child_indexing.delete_translation_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler: + + netgen_search_extra.parent_child_indexing.hide_content_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: netgen.parent_child_indexer.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler: + + netgen_search_extra.parent_child_indexing.publish_version_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: netgen.parent_child_indexer.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler: + + netgen_search_extra.parent_child_indexing.reveal_content_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: netgen.parent_child_indexer.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler: + + netgen_search_extra.parent_child_indexing.update_content_metadata_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/location.yaml b/lib/Resources/config/search/common/parent_child_indexing/location.yaml index 6d2c81ea..b81edb22 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/location.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/location.yaml @@ -1,81 +1,91 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler: + netgen_search_extra.parent_child_indexing.assign_section_to_subtree_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler: + netgen_search_extra.parent_child_indexing.copy_subtree_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler: + netgen_search_extra.parent_child_indexing.create_location_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler: + netgen_search_extra.parent_child_indexing.delete_location_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler: + netgen_search_extra.parent_child_indexing.hide_location_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler: + netgen_search_extra.parent_child_indexing.move_subtree_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler: + netgen_search_extra.parent_child_indexing.swap_location_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler: + netgen_search_extra.parent_child_indexing.unhide_location_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler: + + netgen_search_extra.parent_child_indexing.update_location_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - - { name: monolog.logger, channel: ngsearchextra } \ No newline at end of file + - { name: monolog.logger, channel: ngsearchextra }ž diff --git a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml index 2f95e29b..ed5be2c9 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml @@ -1,7 +1,8 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler: + netgen_search_extra.parent_child_indexing.set_content_state_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: netgen.parent_child_indexer.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/section.yaml b/lib/Resources/config/search/common/parent_child_indexing/section.yaml index e5c3c88e..68afc4c3 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/section.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/section.yaml @@ -1,7 +1,8 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler: + netgen_search_extra.parent_child_indexing.assign_section_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: netgen.parent_child_indexer.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml index 5c5fd683..4ed83b69 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml @@ -1,17 +1,19 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler: + netgen_search_extra.parent_child_indexing.recover_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler: + netgen_search_extra.parent_child_indexing.trash_handler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } From 3dab5527f3761c21e2eba72ae8fb54af750f16eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 28 Mar 2024 11:31:32 +0100 Subject: [PATCH 06/74] NGSTACK-836 FulltextFieldResolver interface and remove search from ParentChildFieldMapper --- .../FieldMapper/FullTextFieldResolver.php | 13 ++++ .../NativeFulltextFieldResolver.php} | 5 +- .../FieldMapper/ParentChildFieldMapper.php | 74 ++++++++++--------- 3 files changed, 56 insertions(+), 36 deletions(-) create mode 100644 lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php rename lib/Core/Search/Solr/FieldMapper/{FulltextFieldResolver.php => FullTextFieldResolver/NativeFulltextFieldResolver.php} (90%) diff --git a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php new file mode 100644 index 00000000..675ee4a5 --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php @@ -0,0 +1,13 @@ +loadChildrenContentInfoList( $contentInfo, - $languageCode, $childrenConfiguration, ); @@ -139,10 +139,11 @@ private function getContentTypeIdentifier(int $contentTypeId): ?string * @param array $configuration * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] + * @throws BadStateException + * @throws InvalidCriterionArgumentException */ private function loadChildrenContentInfoList( ContentInfo $contentInfo, - string $languageCode, array $configuration, ): array { $contentTypeIdentifiers = array_keys($configuration); @@ -150,31 +151,36 @@ private function loadChildrenContentInfoList( if (count($contentTypeIdentifiers) === 0) { return []; } + $filter = new Filter(); + $filter + ->withCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($contentTypeIdentifiers), + new ParentLocationId($contentInfo->mainLocationId), + ]) + ) + ->withLimit($this->childrenLimit); + + $contentItemList = $this->contentFilteringHandler->find($filter); + $items = []; + + foreach ($contentItemList as $contentItem) { + $contentLocations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentItem->contentInfo->id); + + foreach ($contentLocations as $contentLocation) { + if ( + $contentLocation->parentId === $contentInfo->mainLocationId + && !$contentLocation->hidden + && !$contentLocation->invisible + && !$contentInfo->isHidden + ) { + $items[] = $contentItem->contentInfo; + + break; + } + } + } - $searchResult = $this->searchHandler->findContent( - new Query([ - 'filter' => new LocationQueryCriterion( - new LogicalAnd([ - new ContentTypeIdentifier($contentTypeIdentifiers), - new ParentLocationId($contentInfo->mainLocationId), - new Visible(true), - ]), - ), - 'limit' => $this->childrenLimit, - ]), - [ - 'languages' => [ - $languageCode, - ], - ], - ); - - /** @var \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] $result */ - $result = array_map( - static fn (SearchHit $searchHit) => $searchHit->valueObject, - $searchResult->searchHits, - ); - - return $result; + return $items; } } From ffa187f5c60a3d36ded4657d6c6672ba7f5249ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 28 Mar 2024 13:05:27 +0100 Subject: [PATCH 07/74] NGSTACK-836 use persistence location handler instead of location service --- .../Common/EventSubscriber/ContentEventSubscriber.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php index 6676b24a..be16f173 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\Repository\LocationService; +use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; 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 $contentParentLocations = []; public function __construct( private readonly MessageBusInterface $messageBus, - private readonly LocationService $locationService, + private readonly PersistenceHandler $persistenceHandler, ) {} @@ -59,7 +59,7 @@ public function onCopyContent(CopyContentEvent $event): void public function onBeforeDeleteContent(BeforeDeleteContentEvent $event): void { - $contentLocations = $this->locationService->loadLocations($event->getContentInfo()); + $contentLocations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContentInfo()->id); try { foreach ($contentLocations as $contentLocation){ $this->contentParentLocations[] = $contentLocation->parentLocationId; From fc39cb6516a8d8b758ca55cc52722b83951e5951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 28 Mar 2024 14:10:58 +0100 Subject: [PATCH 08/74] NGSTACK-836 add content id as key to parent ids property and unset property after the message is dispatched --- .../Common/EventSubscriber/ContentEventSubscriber.php | 8 ++++---- .../Messenger/Message/Search/Content/DeleteContent.php | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php index be16f173..7177c672 100644 --- a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php +++ b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php @@ -26,7 +26,7 @@ class ContentEventSubscriber implements EventSubscriberInterface { - private array $contentParentLocations = []; + private array $parentLocationIdsByContentId = []; public function __construct( private readonly MessageBusInterface $messageBus, private readonly PersistenceHandler $persistenceHandler, @@ -62,7 +62,7 @@ public function onBeforeDeleteContent(BeforeDeleteContentEvent $event): void $contentLocations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContentInfo()->id); try { foreach ($contentLocations as $contentLocation){ - $this->contentParentLocations[] = $contentLocation->parentLocationId; + $this->parentLocationIdsByContentId[$event->getContentInfo()->id][] = $contentLocation->parentLocationId; } } catch (Throwable) { // does nothing @@ -71,14 +71,14 @@ public function onBeforeDeleteContent(BeforeDeleteContentEvent $event): void public function onDeleteContent(DeleteContentEvent $event): void { - $parentLocationIds = $this->contentParentLocations ?? []; $this->messageBus->dispatch( new DeleteContent( $event->getContentInfo()->id, $event->getLocations(), - $parentLocationIds, + $this->parentLocationIdsByContentId[$event->getContentInfo()->id] ?? [], ), ); + $this->parentLocationIdsByContentId = []; } public function onDeleteTranslation(DeleteTranslationEvent $event): void diff --git a/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php b/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php index aff1ee3b..4c660d05 100644 --- a/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php +++ b/lib/Core/Search/Common/Messenger/Message/Search/Content/DeleteContent.php @@ -8,6 +8,7 @@ final class DeleteContent { /** * @param int[] $locationIds + * @param int[] $parentLocationIds */ public function __construct( public readonly int $contentId, From e0cf67aa9fcbdea203e52828f20150caf56e1aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 28 Mar 2024 15:32:50 +0100 Subject: [PATCH 09/74] NGSTACK-836 replace persistance handler with location handler, use indexSingleForParent location method for trash and move subtree handlers and fix bugs --- lib/Container/Compiler/AsynchronousIndexingPass.php | 2 +- .../Common/EventSubscriber/ContentEventSubscriber.php | 10 +++++----- .../Search/ParentChildIndexing/AncestorIndexer.php | 9 ++++----- .../Content/DeleteContentHandler.php | 2 +- .../Location/MoveSubtreeHandler.php | 2 +- .../Search/ParentChildIndexing/Trash/TrashHandler.php | 2 +- .../Search/Solr/FieldMapper/ParentChildFieldMapper.php | 8 +++----- .../Search/Solr/ParentChildReindexAncestorResolver.php | 2 +- .../search/common/parent_child_indexing/common.yaml | 2 +- 9 files changed, 18 insertions(+), 21 deletions(-) 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 } From ac7aadf501c454a455eaa4c149b0de7454fb3e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:08:42 +0200 Subject: [PATCH 10/74] NGSTACK-836: use class constant instead of FQCN --- lib/Container/Compiler/AsynchronousIndexingPass.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Container/Compiler/AsynchronousIndexingPass.php b/lib/Container/Compiler/AsynchronousIndexingPass.php index 012165bd..82062a68 100644 --- a/lib/Container/Compiler/AsynchronousIndexingPass.php +++ b/lib/Container/Compiler/AsynchronousIndexingPass.php @@ -19,6 +19,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; +use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; final class AsynchronousIndexingPass implements CompilerPassInterface { @@ -37,7 +38,7 @@ public function process(ContainerBuilder $container): void ->setDecoratedService(CoreContentEventSubscriber::class) ->setArguments([ new Reference('netgen.ibexa_search_extra.asynchronous_indexing.messenger.bus'), - new Reference('Ibexa\Contracts\Core\Persistence\Content\Location\Handler'), + new Reference(LocationHandler::class), ]); $container From 42892fe5e30476ff0e2243ed502506ea6d8fd92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:11:18 +0200 Subject: [PATCH 11/74] NGSTACK-836: add strict types declaration and fix CS --- lib/Container/Compiler/ParentChildIndexingPass.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Container/Compiler/ParentChildIndexingPass.php b/lib/Container/Compiler/ParentChildIndexingPass.php index 0eaeaac5..cb37b0fa 100644 --- a/lib/Container/Compiler/ParentChildIndexingPass.php +++ b/lib/Container/Compiler/ParentChildIndexingPass.php @@ -1,5 +1,7 @@ getDefinition($serviceId); $definition->addTag(self::MessageHandlerTag); } - } -} \ No newline at end of file +} From c5735cbf0981b2174e14d9da117fecdb9069bd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:11:50 +0200 Subject: [PATCH 12/74] NGSTACK-836: add property type annotation and fix CS --- .../Common/EventSubscriber/ContentEventSubscriber.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php index b6e0ea85..c584bcbf 100644 --- a/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php +++ b/lib/Core/Search/Common/EventSubscriber/ContentEventSubscriber.php @@ -26,11 +26,14 @@ class ContentEventSubscriber implements EventSubscriberInterface { + /** + * @var array + */ private array $parentLocationIdsByContentId = []; + public function __construct( private readonly MessageBusInterface $messageBus, - private readonly LocationHandler $locationHandler, - + private readonly LocationHandler $locationHandler, ) {} public static function getSubscribedEvents(): array @@ -60,6 +63,7 @@ public function onCopyContent(CopyContentEvent $event): void public function onBeforeDeleteContent(BeforeDeleteContentEvent $event): void { $contentLocations = $this->locationHandler->loadLocationsByContent($event->getContentInfo()->id); + try { foreach ($contentLocations as $contentLocation){ $this->parentLocationIdsByContentId[$event->getContentInfo()->id][] = $contentLocation->parentId; @@ -78,6 +82,7 @@ public function onDeleteContent(DeleteContentEvent $event): void $this->parentLocationIdsByContentId[$event->getContentInfo()->id] ?? [], ), ); + unset($this->parentLocationIdsByContentId[$event->getContentInfo()->id]); } From 0c6ebabde883130c4d21c558aa5f34fb553d8528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:12:25 +0200 Subject: [PATCH 13/74] NGSTACK-836: fix CS --- .../Search/ParentChildIndexing/AncestorIndexer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ebe6c64c..e07ea30d 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php @@ -4,11 +4,11 @@ namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing; -use Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Search\VersatileHandler; +use Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver; final class AncestorIndexer { @@ -22,7 +22,6 @@ public function indexSingle(Location $location): void { $ancestor = $this->ancestorResolver->resolveAncestor($location); - if ($ancestor === null) { return; } @@ -43,6 +42,7 @@ public function indexSingle(Location $location): void public function indexSingleForParentLocation(Location $location): void { $ancestor = $this->ancestorResolver->resolveAncestorForParentLocation($location); + if ($ancestor === null) { return; } From 4c30c149be82d4b09af974236bd449ba1724500d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:13:26 +0200 Subject: [PATCH 14/74] NGSTACK-836: fix CS --- .../ParentChildIndexing/Content/DeleteContentHandler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 c9b73be0..9e380d1e 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 @@ -4,10 +4,10 @@ namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; @@ -23,7 +23,7 @@ public function __construct( public function __invoke(DeleteContent $message): void { - if ($message->parentLocationIds === []) { + if (count($message->parentLocationIds) === 0) { $this->logger->info( sprintf( '%s: Could not find main Location parent Location ID for deleted Content #%d, aborting', @@ -34,7 +34,9 @@ public function __invoke(DeleteContent $message): void return; } + $locations = []; + foreach ($message->parentLocationIds as $locationId) { try { $locations[] = $this->locationHandler->load($locationId); @@ -48,6 +50,7 @@ public function __invoke(DeleteContent $message): void ); } } + $this->ancestorIndexer->indexMultipleForParentLocation($locations); } } From aff2274a48a9ada13d188ed6a154b58ff5797e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:13:52 +0200 Subject: [PATCH 15/74] NGSTACK-836: remove unused imports --- .../ParentChildIndexing/Content/DeleteTranslationHandler.php | 1 - .../Search/ParentChildIndexing/Content/PublishVersionHandler.php | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php index e8cfd393..ab20de5d 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php @@ -12,7 +12,6 @@ use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteTranslation; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; -use Symfony\Component\Messenger\Attribute\AsMessageHandler; use function sprintf; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php index 5a27392e..d248be27 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php @@ -7,7 +7,6 @@ use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\PublishVersion; -use Symfony\Component\Messenger\Attribute\AsMessageHandler; final class PublishVersionHandler { From 50bf569a05b56260b505cc14132c12e65bac4849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:14:15 +0200 Subject: [PATCH 16/74] NGSTACK-836: add strict types declaration and fix CS --- lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php index 675ee4a5..973adc53 100644 --- a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php +++ b/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php @@ -1,5 +1,7 @@ Date: Wed, 29 May 2024 08:14:49 +0200 Subject: [PATCH 17/74] NGSTACK-836: use getters instead of magic get and fix CS --- .../FullTextFieldResolver/NativeFulltextFieldResolver.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php index a904abb2..39e1e1af 100644 --- a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php +++ b/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php @@ -52,7 +52,7 @@ public function resolveFields(SPIContent $content, string $languageCode): array $indexFields = $fieldType->getIndexData($field, $fieldDefinition); foreach ($indexFields as $indexField) { - if ($indexField->value === null) { + if ($indexField->getValue() === null) { continue; } @@ -62,12 +62,13 @@ public function resolveFields(SPIContent $content, string $languageCode): array $fields[] = new Field( 'meta_content__text', - (string) $indexField->value, + (string) $indexField->getValue(), new TextField(), ); } } } + return $fields; } } From 8f8445051276fff49a6987170aeaa4cf0ec9087c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:17:20 +0200 Subject: [PATCH 18/74] NGSTACK-836: fix case mismatch --- lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php index ada21fae..e8246e3e 100644 --- a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php @@ -36,7 +36,7 @@ final class ParentChildFieldMapper extends ContentTranslationFieldMapper */ public function __construct( private readonly array $configuration, - private readonly FulltextFieldResolver $fulltextFieldResolver, + private readonly FullTextFieldResolver $fullTextFieldResolver, private readonly ContentTypeHandler $contentTypeHandler, private readonly ContentHandler $contentHandler, private readonly Handler $contentFilteringHandler, @@ -89,7 +89,7 @@ private function recursiveMapFields( if ($isIndexed && $doIndex) { $content = $this->contentHandler->load($contentInfo->id); - $fieldsGrouped[] = $this->fulltextFieldResolver->resolveFields($content, $languageCode); + $fieldsGrouped[] = $this->fullTextFieldResolver->resolveFields($content, $languageCode); } $childrenContentInfoList = $this->loadChildrenContentInfoList( From 7453dd5f6f15725700444b2cdfa4801f3afc97bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:18:10 +0200 Subject: [PATCH 19/74] NGSTACK-836: clean up docblocks --- .../Solr/FieldMapper/ParentChildFieldMapper.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php index e8246e3e..cf78fbe4 100644 --- a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php @@ -44,6 +44,9 @@ public function __construct( private readonly int $childrenLimit = 99, ) {} + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ public function accept(SPIContent $content, $languageCode): bool { $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; @@ -56,6 +59,10 @@ public function accept(SPIContent $content, $languageCode): bool /** * @param string $languageCode * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * * @return \Ibexa\Contracts\Core\Search\Field[] */ public function mapFields(SPIContent $content, $languageCode): array @@ -73,7 +80,10 @@ public function mapFields(SPIContent $content, $languageCode): array } /** - * @param array $configuration + * @param array|null $configuration + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * * @return \Ibexa\Contracts\Core\Search\Field[] */ @@ -136,9 +146,10 @@ private function getContentTypeIdentifier(int $contentTypeId): ?string /** * @param array $configuration * - * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] * @throws BadStateException * @throws InvalidCriterionArgumentException + * + * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] */ private function loadChildrenContentInfoList( ContentInfo $contentInfo, From 5583ecfcedbac4cb6721536075344bf3e05aca84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:18:43 +0200 Subject: [PATCH 20/74] NGSTACK-836: remove unnecessary type cast --- lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php index cf78fbe4..209747e4 100644 --- a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php @@ -94,7 +94,7 @@ private function recursiveMapFields( bool $doIndex = true, ): array { $fieldsGrouped = [[]]; - $isIndexed = !isset($configuration['indexed']) || (bool) $configuration['indexed']; + $isIndexed = !isset($configuration['indexed']) || $configuration['indexed']; $childrenConfiguration = $configuration['children'] ?? []; if ($isIndexed && $doIndex) { From a0f3b7e2e0cadd80a914a3367551baeb2c9f2a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:19:13 +0200 Subject: [PATCH 21/74] NGSTACK-836: clean up docblocks --- .../Search/Solr/ParentChildReindexAncestorResolver.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php index 3e9ddcc1..3de7d59b 100644 --- a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php +++ b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php @@ -59,9 +59,7 @@ public function resolveAncestor(Location $location): ?Location } /** - * Return the location if its content type matches the path parent - * - * @param Location $location + * Return the location if its content type matches the path parent. */ public function resolveAncestorForParentLocation(Location $location): ?Location { @@ -135,11 +133,17 @@ private function addToAncestry(array &$ancestry): bool return true; } + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ private function getParentLocation(Location $location): Location { return $this->locationHandler->load($location->parentId); } + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ private function getContentTypeIdentifier(Location $location): string { /** @var int $contentId */ From 7697c0e6a260320c33ebfb66e79236d3fabcf951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:19:39 +0200 Subject: [PATCH 22/74] NGSTACK-836: fix CS --- lib/Resources/config/search/common/parent_child_indexing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Resources/config/search/common/parent_child_indexing.yaml b/lib/Resources/config/search/common/parent_child_indexing.yaml index 21e72909..22e3d1be 100644 --- a/lib/Resources/config/search/common/parent_child_indexing.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing.yaml @@ -7,4 +7,4 @@ imports: - { resource: parent_child_indexing/trash.yaml } parameters: - netgen.ibexa_search_extra.parent_child_indexer: [] \ No newline at end of file + netgen.ibexa_search_extra.parent_child_indexer: [] From 602f4d2d8fc5e454da267e43c2eb2baac65cf363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:20:59 +0200 Subject: [PATCH 23/74] NGSTACK-836: fix spacing --- .../config/search/common/parent_child_indexing/common.yaml | 3 --- .../config/search/common/parent_child_indexing/content.yaml | 6 +----- 2 files changed, 1 insertion(+), 8 deletions(-) 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 e7594e1f..3cc23061 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -11,7 +11,6 @@ services: tags: - { name: ibexa.search.solr.field.mapper.content.translation } - netgen_search_extra.parent_child_indexing.parent_child_reindex_ancestor_resolver: class: Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver arguments: @@ -20,7 +19,6 @@ services: - '@Ibexa\Core\Persistence\Cache\LocationHandler' - '%netgen.ibexa_search_extra.parent_child_indexer%' - netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FullTextFieldResolver\NativeFulltextFieldResolver arguments: @@ -36,4 +34,3 @@ services: - '@Ibexa\Contracts\Core\Search\VersatileHandler' - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - '@netgen_search_extra.parent_child_indexing.parent_child_reindex_ancestor_resolver' - diff --git a/lib/Resources/config/search/common/parent_child_indexing/content.yaml b/lib/Resources/config/search/common/parent_child_indexing/content.yaml index e0f09b89..2953a22d 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/content.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/content.yaml @@ -7,7 +7,6 @@ services: tags: - { name: netgen.parent_child_indexer.message_handler } - netgen_search_extra.parent_child_indexing.delete_content_handler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler arguments: @@ -38,7 +37,6 @@ services: tags: - { name: netgen.parent_child_indexer.message_handler } - netgen_search_extra.parent_child_indexing.publish_version_handler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler arguments: @@ -47,7 +45,6 @@ services: tags: - { name: netgen.parent_child_indexer.message_handler } - netgen_search_extra.parent_child_indexing.reveal_content_handler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler arguments: @@ -56,7 +53,6 @@ services: tags: - { name: netgen.parent_child_indexer.message_handler } - netgen_search_extra.parent_child_indexing.update_content_metadata_handler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler arguments: @@ -66,4 +62,4 @@ services: - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - - { name: monolog.logger, channel: ngsearchextra } \ No newline at end of file + - { name: monolog.logger, channel: ngsearchextra } From ba60332503668c111e02bf9ab4d88cafe7c022d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 08:21:26 +0200 Subject: [PATCH 24/74] NGSTACK-836: move configuration to the bottom --- lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php | 2 +- .../config/search/common/parent_child_indexing/common.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php index 209747e4..c6cd7f62 100644 --- a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php @@ -35,12 +35,12 @@ final class ParentChildFieldMapper extends ContentTranslationFieldMapper * @param array $configuration */ public function __construct( - private readonly array $configuration, private readonly FullTextFieldResolver $fullTextFieldResolver, private readonly ContentTypeHandler $contentTypeHandler, private readonly ContentHandler $contentHandler, private readonly Handler $contentFilteringHandler, private readonly LocationHandler $locationHandler, + private readonly array $configuration, private readonly int $childrenLimit = 99, ) {} 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 3cc23061..75642cd1 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -2,12 +2,12 @@ services: netgen_search_extra.parent_child_indexing.parent_child_field_mapper: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ParentChildFieldMapper arguments: - - '%netgen.ibexa_search_extra.parent_child_indexer%' - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '%netgen.ibexa_search_extra.parent_child_indexer%' tags: - { name: ibexa.search.solr.field.mapper.content.translation } From f2f1fd9ab235d1e42a5273e8db7725ab3112cf7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 10:57:40 +0200 Subject: [PATCH 25/74] NGSTACK-836: fix CS --- .../config/search/common/parent_child_indexing/content.yaml | 1 - .../config/search/common/parent_child_indexing/location.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/Resources/config/search/common/parent_child_indexing/content.yaml b/lib/Resources/config/search/common/parent_child_indexing/content.yaml index 2953a22d..5818c5b5 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/content.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/content.yaml @@ -28,7 +28,6 @@ services: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.hide_content_handler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler arguments: diff --git a/lib/Resources/config/search/common/parent_child_indexing/location.yaml b/lib/Resources/config/search/common/parent_child_indexing/location.yaml index b81edb22..acd2b967 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/location.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/location.yaml @@ -79,7 +79,6 @@ services: - { name: netgen.parent_child_indexer.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.update_location_handler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler arguments: From 84eaa7970d94ffa4c3e7438cc0882c62a8fcf8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 10:58:09 +0200 Subject: [PATCH 26/74] NGSTACK-836: fix typo --- .../config/search/common/parent_child_indexing/location.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Resources/config/search/common/parent_child_indexing/location.yaml b/lib/Resources/config/search/common/parent_child_indexing/location.yaml index acd2b967..67c2c630 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/location.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/location.yaml @@ -87,4 +87,4 @@ services: - '@?logger' tags: - { name: netgen.parent_child_indexer.message_handler } - - { name: monolog.logger, channel: ngsearchextra }ž + - { name: monolog.logger, channel: ngsearchextra } From a019fc70fda4d75625f5c8d08fbf450f6d6f498d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 11:00:38 +0200 Subject: [PATCH 27/74] NGSTACK-836: fix async indexing tests and prepare for testing parent-child indexer --- .github/workflows/tests.yml | 134 +++++++- ...e-integration-legacy-solr-asynchronous.xml | 43 +++ phpunit-integration-solr-asynchronous.xml | 23 ++ ...vent_dispatcher_override_asynchronous.yaml | 311 ++++++++++++++++++ .../Resources/config/services.yaml | 47 --- .../SetupFactory/RegressionSolr.php | 1 + .../RegressionSolrAsynchronous.php | 43 +++ .../SetupFactory/SolrAsynchronous.php | 43 +++ 8 files changed, 597 insertions(+), 48 deletions(-) create mode 100644 phpunit-core-integration-legacy-solr-asynchronous.xml create mode 100644 phpunit-integration-solr-asynchronous.xml create mode 100644 tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml create mode 100644 tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php create mode 100644 tests/lib/Integration/SetupFactory/SolrAsynchronous.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 533d0066..ce1de034 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ on: jobs: tests: - name: ${{ matrix.php }} ${{ matrix.coverage }} ${{ matrix.engine }} ${{ matrix.solr_version }} ${{ matrix.regression }} ${{ matrix.core_setup }} + name: ${{ matrix.php }} ${{ matrix.coverage }} ${{ matrix.engine }} ${{ matrix.solr_version }} ${{ matrix.regression }} ${{ matrix.asynchronous }} ${{ matrix.core_setup }} runs-on: "ubuntu-22.04" env: extensions: pdo_sqlite @@ -53,6 +53,37 @@ jobs: solr_cloud: 'yes' core_setup: 'cloud' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '7.7.3' + solr_cores: 'collection1' + core_setup: 'single' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '7.7.3' + core_setup: 'dedicated' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '7.7.3' + core_setup: 'shared' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '7.7.3' + solr_cloud: 'yes' + core_setup: 'cloud' + asynchronous: 'asynchronous' + - php: '8.1' coverage: 'integration' engine: 'solr' @@ -84,6 +115,41 @@ jobs: core_setup: 'cloud' regression: 'regression' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '7.7.3' + solr_cores: 'collection1' + core_setup: 'single' + regression: 'regression' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '7.7.3' + core_setup: 'dedicated' + regression: 'regression' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '7.7.3' + core_setup: 'shared' + regression: 'regression' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '7.7.3' + solr_cloud: 'yes' + core_setup: 'cloud' + regression: 'regression' + asynchronous: 'asynchronous' + - php: '8.1' coverage: 'integration' engine: 'solr' @@ -111,6 +177,37 @@ jobs: solr_cloud: 'yes' core_setup: 'cloud' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '8.11.2' + solr_cores: 'collection1' + core_setup: 'single' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '8.11.2' + core_setup: 'dedicated' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '8.11.2' + core_setup: 'shared' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-integration-solr-asynchronous.xml' + solr_version: '8.11.2' + solr_cloud: 'yes' + core_setup: 'cloud' + asynchronous: 'asynchronous' + - php: '8.1' coverage: 'integration' engine: 'solr' @@ -142,6 +239,41 @@ jobs: core_setup: 'cloud' regression: 'regression' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '8.11.2' + solr_cores: 'collection1' + core_setup: 'single' + regression: 'regression' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '8.11.2' + core_setup: 'dedicated' + regression: 'regression' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '8.11.2' + core_setup: 'shared' + regression: 'regression' + asynchronous: 'asynchronous' + - php: '8.1' + coverage: 'integration' + engine: 'solr' + config: 'phpunit-core-integration-legacy-solr-asynchronous.xml' + solr_version: '8.11.2' + solr_cloud: 'yes' + core_setup: 'cloud' + regression: 'regression' + asynchronous: 'asynchronous' + steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 diff --git a/phpunit-core-integration-legacy-solr-asynchronous.xml b/phpunit-core-integration-legacy-solr-asynchronous.xml new file mode 100644 index 00000000..387e6437 --- /dev/null +++ b/phpunit-core-integration-legacy-solr-asynchronous.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + tests/lib/Kernel + vendor/ibexa/core/tests/integration/Core + vendor/ibexa/core/tests/integration/Core/Repository/Filtering + + vendor/ibexa/core/tests/integration/Core/Repository/SearchServiceTest.php + vendor/ibexa/core/tests/integration/Core/Repository/SearchServiceLocationTest.php + + + + + tests/integration + + + diff --git a/phpunit-integration-solr-asynchronous.xml b/phpunit-integration-solr-asynchronous.xml new file mode 100644 index 00000000..2502fb9d --- /dev/null +++ b/phpunit-integration-solr-asynchronous.xml @@ -0,0 +1,23 @@ + + + + + + + + + + ./tests/lib/Integration/ + + + + + ./bundle + ./lib + + + diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml new file mode 100644 index 00000000..d942b9f2 --- /dev/null +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -0,0 +1,311 @@ +services: + netgen_search_extra.parent_child_indexing.parent_child_field_mapper: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ParentChildFieldMapper + arguments: + - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' + - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '%netgen.ibexa_search_extra.parent_child_indexer%' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + tags: + - { name: messenger.message_handler } + + netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.handler.locator: + class: Symfony\Component\Messenger\Handler\HandlersLocator + arguments: + - + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\CopyContent': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\CopyContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteTranslation': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteTranslationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\HideContent': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\HideContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\PublishVersion': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\PublishVersionHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\RevealContent': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\RevealContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\UpdateContentMetadata': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\UpdateContentMetadataHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\AssignSectionToSubtree': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\AssignSectionToSubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CopySubtree': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CopySubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CreateLocation': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CreateLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\DeleteLocation': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\DeleteLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\HideLocation': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\HideLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\MoveSubtree': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\MoveSubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\SwapLocation': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\SwapLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UnhideLocation': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UnhideLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UpdateLocation': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UpdateLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\ObjectState\SetContentState': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ObjectState\SetContentStateHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Section\AssignSection': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Section\AssignSectionHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Recover': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\RecoverHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Trash': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\TrashHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\AssignUserToUserGroup': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\AssignUserToUserGroupHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\BeforeUnAssignUserFromUserGroup': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\BeforeUnAssignUserFromUserGroupHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUserGroup': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserGroupHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUser': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUserGroup': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserGroupHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUser': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\MoveUserGroup': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\MoveUserGroupHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UnAssignUserFromUserGroup': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UnAssignUserFromUserGroupHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUserGroup': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserGroupHandler' + 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUser': + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserHandler' + + netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.middleware: + class: Symfony\Component\Messenger\Middleware\HandleMessageMiddleware + arguments: + - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.handler.locator' + + netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus: + class: Symfony\Component\Messenger\MessageBus + arguments: + - ['@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.middleware'] + + netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.content: + class: Netgen\IbexaSearchExtra\Core\Search\Common\EventSubscriber\ContentEventSubscriber + arguments: + - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + + netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.location: + class: Netgen\IbexaSearchExtra\Core\Search\Common\EventSubscriber\LocationEventSubscriber + arguments: + - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus' + + netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.object_state: + class: Netgen\IbexaSearchExtra\Core\Search\Common\EventSubscriber\ObjectStateEventSubscriber + arguments: + - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus' + + netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.section: + class: Netgen\IbexaSearchExtra\Core\Search\Common\EventSubscriber\SectionEventSubscriber + arguments: + - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus' + + netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.trash: + class: Netgen\IbexaSearchExtra\Core\Search\Common\EventSubscriber\TrashEventSubscriber + arguments: + - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus' + + netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.user: + class: Netgen\IbexaSearchExtra\Core\Search\Common\EventSubscriber\UserEventSubscriber + arguments: + - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus' + + Symfony\Component\EventDispatcher\EventDispatcher: + calls: + - ['addSubscriber', ['@netgen_test.ibexa_search_extra.solr.event_subscriber.child_updates_parent']] + - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.content']] + - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.location']] + - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.object_state']] + - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.section']] + - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.trash']] + - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.user']] + - ['addSubscriber', ['@Ibexa\Core\Repository\EventSubscriber\NameSchemaSubscriber' ]] diff --git a/tests/lib/Integration/Resources/config/services.yaml b/tests/lib/Integration/Resources/config/services.yaml index 66621e7a..8edbc52a 100644 --- a/tests/lib/Integration/Resources/config/services.yaml +++ b/tests/lib/Integration/Resources/config/services.yaml @@ -46,52 +46,5 @@ services: tags: - { name: ibexa.search.solr.field.mapper.location } - netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus: - class: Symfony\Component\Messenger\MessageBus - arguments: - - ['@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.middleware'] - - netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.middleware: - class: Symfony\Component\Messenger\Middleware\HandleMessageMiddleware - arguments: - - '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.handler.locator' - - netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.handler.locator: - class: Symfony\Component\Messenger\Handler\HandlersLocator - arguments: - - - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\CopyContent': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\CopyContentHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteContentHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteTranslation': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteTranslationHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\HideContent': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\HideContentHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\PublishVersion': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\PublishVersionHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\RevealContent': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\RevealContentHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\UpdateContentMetadata': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\UpdateContentMetadataHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\AssignSectionToSubtree': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\AssignSectionToSubtreeHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CopySubtree': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CopySubtreeHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CreateLocation': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CreateLocationHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\DeleteLocation': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\DeleteLocationHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\HideLocation': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\HideLocationHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\MoveSubtree': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\MoveSubtreeHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\SwapLocation': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\SwapLocationHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UnhideLocation': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UnhideLocationHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UpdateLocation': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UpdateLocationHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\ObjectState\SetContentState': [ '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ObjectState\SetContentStateHandler' ] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Section\AssignSection': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Section\AssignSectionHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Recover': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\RecoverHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Trash': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\TrashHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\AssignUserToUserGroup': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\AssignUserToUserGroupHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\BeforeUnAssignUserFromUserGroup': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\BeforeUnAssignUserFromUserGroupHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUserGroup': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserGroupHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUser': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUserGroup': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserGroupHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUser': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\MoveUserGroup': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\MoveUserGroupHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UnAssignUserFromUserGroup': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UnAssignUserFromUserGroupHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUserGroup': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserGroupHandler'] - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUser': ['@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserHandler'] - - netgen.ibexa_search_extra.asynchronous_indexing.messenger.bus: '@netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.bus' - Ibexa\Bundle\Core\Routing\UrlAliasRouter: class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Stubs\RouterStub diff --git a/tests/lib/Integration/SetupFactory/RegressionSolr.php b/tests/lib/Integration/SetupFactory/RegressionSolr.php index 443a4386..07072dc1 100644 --- a/tests/lib/Integration/SetupFactory/RegressionSolr.php +++ b/tests/lib/Integration/SetupFactory/RegressionSolr.php @@ -30,6 +30,7 @@ protected function externalBuildContainer(ContainerBuilder $containerBuilder): v $testConfigPath = __DIR__ . '/../Resources/config/'; $loader = new YamlFileLoader($containerBuilder, new FileLocator($testConfigPath)); $loader->load('services.yaml'); + $loader->load('event_dispatcher_override.yaml'); // Needs to be added first because other passes depend on it $containerBuilder->addCompilerPass(new Compiler\TagSubdocumentCriterionVisitorsPass()); diff --git a/tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php b/tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php new file mode 100644 index 00000000..03107fa1 --- /dev/null +++ b/tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php @@ -0,0 +1,43 @@ +load('search/common.yaml'); + $loader->load('search/solr_services.yaml'); + $loader->load('search/solr_engine.yaml'); + + $testConfigPath = __DIR__ . '/../Resources/config/'; + $loader = new YamlFileLoader($containerBuilder, new FileLocator($testConfigPath)); + $loader->load('services.yaml'); + $loader->load('event_dispatcher_override_asynchronous.yaml'); + + // Needs to be added first because other passes depend on it + $containerBuilder->addCompilerPass(new Compiler\TagSubdocumentCriterionVisitorsPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateContentSubdocumentMapperPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateContentTranslationSubdocumentMapperPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass()); + $containerBuilder->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass()); + } +} diff --git a/tests/lib/Integration/SetupFactory/SolrAsynchronous.php b/tests/lib/Integration/SetupFactory/SolrAsynchronous.php new file mode 100644 index 00000000..7a806923 --- /dev/null +++ b/tests/lib/Integration/SetupFactory/SolrAsynchronous.php @@ -0,0 +1,43 @@ +load('search/common.yaml'); + $loader->load('search/solr_services.yaml'); + $loader->load('search/solr_engine.yaml'); + + $testConfigPath = __DIR__ . '/../Resources/config/'; + $loader = new YamlFileLoader($containerBuilder, new FileLocator($testConfigPath)); + $loader->load('services.yaml'); + $loader->load('event_dispatcher_override_asynchronous.yaml'); + + // Needs to be added first because other passes depend on it + $containerBuilder->addCompilerPass(new Compiler\TagSubdocumentCriterionVisitorsPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateContentSubdocumentMapperPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateContentTranslationSubdocumentMapperPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass()); + $containerBuilder->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass()); + $containerBuilder->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass()); + } +} From 6837403d234e1409326fcd5a087e6fd79801e6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 11:39:50 +0200 Subject: [PATCH 28/74] NGSTACK-836: check and skip root Location --- .../Search/ParentChildIndexing/Trash/TrashHandler.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 1b008873..48336671 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 @@ -4,6 +4,7 @@ namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash; +use Ibexa\Contracts\Core\Persistence\Content\Location; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; @@ -39,6 +40,15 @@ public function __invoke(Trash $message): void return; } + if ($this->isRootLocation($location)) { + return; + } + $this->ancestorIndexer->indexSingleForParentLocation($location); } + + private function isRootLocation(Location $location): bool + { + return $location->contentId === 0; + } } From cf58bae01036fa030990453e8d016a47f92565c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 11:40:52 +0200 Subject: [PATCH 29/74] NGSTACK-836: handle exception when resolving content type identifier --- lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php index 3de7d59b..1926892f 100644 --- a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php +++ b/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php @@ -63,7 +63,11 @@ public function resolveAncestor(Location $location): ?Location */ public function resolveAncestorForParentLocation(Location $location): ?Location { - $contentTypeIdentifier = $this->getContentTypeIdentifier($location); + try { + $contentTypeIdentifier = $this->getContentTypeIdentifier($location); + } catch (NotFoundException) { + return null; + } foreach ($this->getPaths() as $path) { if (str_ends_with($path, $contentTypeIdentifier)) { From cfac01601821ad6af0ea39274ada04350e4ece21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 12:11:49 +0200 Subject: [PATCH 30/74] NGSTACK-836: restructure message handlers --- .../Content/CopyContentHandler.php | 2 +- .../Content/DeleteContentHandler.php | 2 +- .../Content/DeleteTranslationHandler.php | 2 +- .../Content/HideContentHandler.php | 4 +- .../Content/PublishVersionHandler.php | 2 +- .../Content/RevealContentHandler.php | 4 +- .../Content/UpdateContentMetadataHandler.php | 2 +- .../AssignSectionToSubtreeHandler.php | 4 +- .../Location/CopySubtreeHandler.php | 4 +- .../Location/CreateLocationHandler.php | 2 +- .../Location/DeleteLocationHandler.php | 2 +- .../Location/HideLocationHandler.php | 4 +- .../Location/MoveSubtreeHandler.php | 4 +- .../Location/SwapLocationHandler.php | 2 +- .../Location/UnhideLocationHandler.php | 4 +- .../Location/UpdateLocationHandler.php | 2 +- .../ObjectState/SetContentStateHandler.php | 2 +- .../Section/AssignSectionHandler.php | 2 +- .../SubtreeIndexer.php | 2 +- .../Trash/RecoverHandler.php | 4 +- .../Trash/TrashHandler.php | 2 +- .../User/AssignUserToUserGroupHandler.php | 4 +- ...BeforeUnAssignUserFromUserGroupHandler.php | 2 +- .../User/CreateUserGroupHandler.php | 2 +- .../User/CreateUserHandler.php | 2 +- .../User/DeleteUserGroupHandler.php | 2 +- .../User/DeleteUserHandler.php | 2 +- .../User/MoveUserGroupHandler.php | 4 +- .../User/UnAssignUserFromUserGroupHandler.php | 4 +- .../User/UpdateUserGroupHandler.php | 2 +- .../User/UpdateUserHandler.php | 2 +- .../UserContentWithLocationIndexer.php | 2 +- .../common/asynchronous_indexing/common.yaml | 4 +- .../common/asynchronous_indexing/content.yaml | 18 +++--- .../asynchronous_indexing/location.yaml | 28 ++++----- .../asynchronous_indexing/object_state.yaml | 2 +- .../common/asynchronous_indexing/section.yaml | 2 +- .../common/asynchronous_indexing/trash.yaml | 6 +- .../common/asynchronous_indexing/user.yaml | 26 ++++---- ...vent_dispatcher_override_asynchronous.yaml | 60 +++++++++---------- 40 files changed, 116 insertions(+), 116 deletions(-) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Content/CopyContentHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Content/DeleteContentHandler.php (93%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Content/DeleteTranslationHandler.php (98%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Content/HideContentHandler.php (88%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Content/PublishVersionHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Content/RevealContentHandler.php (89%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Content/UpdateContentMetadataHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/AssignSectionToSubtreeHandler.php (84%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/CopySubtreeHandler.php (83%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/CreateLocationHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/DeleteLocationHandler.php (91%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/HideLocationHandler.php (83%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/MoveSubtreeHandler.php (83%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/SwapLocationHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/UnhideLocationHandler.php (83%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Location/UpdateLocationHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/ObjectState/SetContentStateHandler.php (96%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Section/AssignSectionHandler.php (96%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/SubtreeIndexer.php (98%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Trash/RecoverHandler.php (83%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/Trash/TrashHandler.php (93%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/AssignUserToUserGroupHandler.php (84%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/BeforeUnAssignUserFromUserGroupHandler.php (94%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/CreateUserGroupHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/CreateUserHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/DeleteUserGroupHandler.php (93%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/DeleteUserHandler.php (93%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/MoveUserGroupHandler.php (93%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/UnAssignUserFromUserGroupHandler.php (84%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/UpdateUserGroupHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/User/UpdateUserHandler.php (97%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ => AsynchronousIndexing}/UserContentWithLocationIndexer.php (97%) diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/CopyContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/CopyContentHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/CopyContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/CopyContentHandler.php index 33dc0a93..c6427eee 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/CopyContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/CopyContentHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/DeleteContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/DeleteContentHandler.php similarity index 93% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/DeleteContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/DeleteContentHandler.php index 399f53c2..b4b8aecd 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/DeleteContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/DeleteContentHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/DeleteTranslationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/DeleteTranslationHandler.php similarity index 98% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/DeleteTranslationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/DeleteTranslationHandler.php index 62f52a24..299b6110 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/DeleteTranslationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/DeleteTranslationHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/HideContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/HideContentHandler.php similarity index 88% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/HideContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/HideContentHandler.php index 6489a5e1..8045dfd8 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/HideContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/HideContentHandler.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\HideContent; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class HideContentHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/PublishVersionHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/PublishVersionHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/PublishVersionHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/PublishVersionHandler.php index 474afd75..d591a408 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/PublishVersionHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/PublishVersionHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/RevealContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/RevealContentHandler.php similarity index 89% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/RevealContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/RevealContentHandler.php index a6fe8a22..fa32eaf2 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/RevealContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/RevealContentHandler.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\RevealContent; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class RevealContentHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/UpdateContentMetadataHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/UpdateContentMetadataHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/UpdateContentMetadataHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/UpdateContentMetadataHandler.php index 8768fe5d..dee53f23 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Content/UpdateContentMetadataHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Content/UpdateContentMetadataHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/AssignSectionToSubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/AssignSectionToSubtreeHandler.php similarity index 84% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/AssignSectionToSubtreeHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/AssignSectionToSubtreeHandler.php index fccf2768..edca93ec 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/AssignSectionToSubtreeHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/AssignSectionToSubtreeHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\AssignSectionToSubtree; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class AssignSectionToSubtreeHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/CopySubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/CopySubtreeHandler.php similarity index 83% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/CopySubtreeHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/CopySubtreeHandler.php index 243699ff..f0de28b4 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/CopySubtreeHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/CopySubtreeHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CopySubtree; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class CopySubtreeHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/CreateLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/CreateLocationHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/CreateLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/CreateLocationHandler.php index 47e01eaa..061fc5e0 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/CreateLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/CreateLocationHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/DeleteLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/DeleteLocationHandler.php similarity index 91% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/DeleteLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/DeleteLocationHandler.php index c803f5a3..bab2e58f 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/DeleteLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/DeleteLocationHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\DeleteLocation; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/HideLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/HideLocationHandler.php similarity index 83% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/HideLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/HideLocationHandler.php index 1fece102..cfee4244 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/HideLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/HideLocationHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\HideLocation; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class HideLocationHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/MoveSubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/MoveSubtreeHandler.php similarity index 83% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/MoveSubtreeHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/MoveSubtreeHandler.php index 5f9b346f..f0c6bd72 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/MoveSubtreeHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/MoveSubtreeHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\MoveSubtree; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class MoveSubtreeHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/SwapLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/SwapLocationHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/SwapLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/SwapLocationHandler.php index 0e6e6e15..77df1bf1 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/SwapLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/SwapLocationHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/UnhideLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/UnhideLocationHandler.php similarity index 83% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/UnhideLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/UnhideLocationHandler.php index 73605ba5..b5549b3d 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/UnhideLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/UnhideLocationHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UnhideLocation; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class UnhideLocationHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/UpdateLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/UpdateLocationHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/UpdateLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/UpdateLocationHandler.php index 503fb993..f93668ae 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Location/UpdateLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Location/UpdateLocationHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ObjectState/SetContentStateHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/ObjectState/SetContentStateHandler.php similarity index 96% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ObjectState/SetContentStateHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/ObjectState/SetContentStateHandler.php index 17f077cb..df5f873f 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ObjectState/SetContentStateHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/ObjectState/SetContentStateHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ObjectState; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\ObjectState; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Section/AssignSectionHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Section/AssignSectionHandler.php similarity index 96% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Section/AssignSectionHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Section/AssignSectionHandler.php index 235e1ae6..b3ee64e7 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Section/AssignSectionHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Section/AssignSectionHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Section; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Section; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/SubtreeIndexer.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/SubtreeIndexer.php similarity index 98% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/SubtreeIndexer.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/SubtreeIndexer.php index 960f1244..ea416bc7 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/SubtreeIndexer.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/SubtreeIndexer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Trash/RecoverHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Trash/RecoverHandler.php similarity index 83% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Trash/RecoverHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Trash/RecoverHandler.php index d79aa1df..cc885487 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Trash/RecoverHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Trash/RecoverHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Recover; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; final class RecoverHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Trash/TrashHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Trash/TrashHandler.php similarity index 93% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/Trash/TrashHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Trash/TrashHandler.php index aea98080..89beb61b 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/Trash/TrashHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/Trash/TrashHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Trash; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/AssignUserToUserGroupHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/AssignUserToUserGroupHandler.php similarity index 84% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/AssignUserToUserGroupHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/AssignUserToUserGroupHandler.php index 0e88d390..9d1f3003 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/AssignUserToUserGroupHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/AssignUserToUserGroupHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\AssignUserToUserGroup; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\UserContentWithLocationIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\UserContentWithLocationIndexer; final class AssignUserToUserGroupHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/BeforeUnAssignUserFromUserGroupHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/BeforeUnAssignUserFromUserGroupHandler.php similarity index 94% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/BeforeUnAssignUserFromUserGroupHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/BeforeUnAssignUserFromUserGroupHandler.php index deb4320a..a09491df 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/BeforeUnAssignUserFromUserGroupHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/BeforeUnAssignUserFromUserGroupHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/CreateUserGroupHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/CreateUserGroupHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/CreateUserGroupHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/CreateUserGroupHandler.php index 2f33db78..f930b500 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/CreateUserGroupHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/CreateUserGroupHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/CreateUserHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/CreateUserHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/CreateUserHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/CreateUserHandler.php index 0af00545..5eef6204 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/CreateUserHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/CreateUserHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/DeleteUserGroupHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/DeleteUserGroupHandler.php similarity index 93% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/DeleteUserGroupHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/DeleteUserGroupHandler.php index 765af82c..344ba767 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/DeleteUserGroupHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/DeleteUserGroupHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUserGroup; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/DeleteUserHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/DeleteUserHandler.php similarity index 93% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/DeleteUserHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/DeleteUserHandler.php index 366b84a7..aaec018d 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/DeleteUserHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/DeleteUserHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUser; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/MoveUserGroupHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/MoveUserGroupHandler.php similarity index 93% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/MoveUserGroupHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/MoveUserGroupHandler.php index e4fafa54..34e81888 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/MoveUserGroupHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/MoveUserGroupHandler.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\MoveUserGroup; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UnAssignUserFromUserGroupHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UnAssignUserFromUserGroupHandler.php similarity index 84% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UnAssignUserFromUserGroupHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UnAssignUserFromUserGroupHandler.php index 9c6eca0c..410fe233 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UnAssignUserFromUserGroupHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UnAssignUserFromUserGroupHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UnAssignUserFromUserGroup; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\UserContentWithLocationIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\UserContentWithLocationIndexer; final class UnAssignUserFromUserGroupHandler { diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UpdateUserGroupHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UpdateUserGroupHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UpdateUserGroupHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UpdateUserGroupHandler.php index 97825e65..e10e5c5f 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UpdateUserGroupHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UpdateUserGroupHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UpdateUserHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UpdateUserHandler.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UpdateUserHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UpdateUserHandler.php index e64da2f2..06368606 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/User/UpdateUserHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/User/UpdateUserHandler.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/UserContentWithLocationIndexer.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/UserContentWithLocationIndexer.php similarity index 97% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/UserContentWithLocationIndexer.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/UserContentWithLocationIndexer.php index 01bbd01b..1df88a27 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/UserContentWithLocationIndexer.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/AsynchronousIndexing/UserContentWithLocationIndexer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Resources/config/search/common/asynchronous_indexing/common.yaml b/lib/Resources/config/search/common/asynchronous_indexing/common.yaml index b02b4075..a3182174 100644 --- a/lib/Resources/config/search/common/asynchronous_indexing/common.yaml +++ b/lib/Resources/config/search/common/asynchronous_indexing/common.yaml @@ -1,5 +1,5 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -8,7 +8,7 @@ services: tags: - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\UserContentWithLocationIndexer: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\UserContentWithLocationIndexer: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' diff --git a/lib/Resources/config/search/common/asynchronous_indexing/content.yaml b/lib/Resources/config/search/common/asynchronous_indexing/content.yaml index ea303fb8..437907f0 100644 --- a/lib/Resources/config/search/common/asynchronous_indexing/content.yaml +++ b/lib/Resources/config/search/common/asynchronous_indexing/content.yaml @@ -1,5 +1,5 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\CopyContentHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\CopyContentHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -9,13 +9,13 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteContentHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\DeleteContentHandler: arguments: - '@ibexa.spi.search' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteTranslationHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\DeleteTranslationHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -25,14 +25,14 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\HideContentHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\HideContentHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\PublishVersionHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\PublishVersionHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -42,14 +42,14 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\RevealContentHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\RevealContentHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\UpdateContentMetadataHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\UpdateContentMetadataHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' diff --git a/lib/Resources/config/search/common/asynchronous_indexing/location.yaml b/lib/Resources/config/search/common/asynchronous_indexing/location.yaml index 287eb478..6aef2ddd 100644 --- a/lib/Resources/config/search/common/asynchronous_indexing/location.yaml +++ b/lib/Resources/config/search/common/asynchronous_indexing/location.yaml @@ -1,17 +1,17 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\AssignSectionToSubtreeHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\AssignSectionToSubtreeHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CopySubtreeHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\CopySubtreeHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CreateLocationHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\CreateLocationHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -21,25 +21,25 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\DeleteLocationHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\DeleteLocationHandler: arguments: - '@ibexa.spi.search' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\HideLocationHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\HideLocationHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\MoveSubtreeHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\MoveSubtreeHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\SwapLocationHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\SwapLocationHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -49,14 +49,14 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UnhideLocationHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\UnhideLocationHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' - '@ibexa.spi.search' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UpdateLocationHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\UpdateLocationHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' diff --git a/lib/Resources/config/search/common/asynchronous_indexing/object_state.yaml b/lib/Resources/config/search/common/asynchronous_indexing/object_state.yaml index b0b32e7c..fd73ad00 100644 --- a/lib/Resources/config/search/common/asynchronous_indexing/object_state.yaml +++ b/lib/Resources/config/search/common/asynchronous_indexing/object_state.yaml @@ -1,5 +1,5 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ObjectState\SetContentStateHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\ObjectState\SetContentStateHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' diff --git a/lib/Resources/config/search/common/asynchronous_indexing/section.yaml b/lib/Resources/config/search/common/asynchronous_indexing/section.yaml index 8a7c330e..af971a52 100644 --- a/lib/Resources/config/search/common/asynchronous_indexing/section.yaml +++ b/lib/Resources/config/search/common/asynchronous_indexing/section.yaml @@ -1,5 +1,5 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Section\AssignSectionHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Section\AssignSectionHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@ibexa.spi.search' diff --git a/lib/Resources/config/search/common/asynchronous_indexing/trash.yaml b/lib/Resources/config/search/common/asynchronous_indexing/trash.yaml index fc3d7813..15f22452 100644 --- a/lib/Resources/config/search/common/asynchronous_indexing/trash.yaml +++ b/lib/Resources/config/search/common/asynchronous_indexing/trash.yaml @@ -1,12 +1,12 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\RecoverHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash\RecoverHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' - '@ibexa.spi.search' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\TrashHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash\TrashHandler: arguments: - '@ibexa.spi.search' tags: diff --git a/lib/Resources/config/search/common/asynchronous_indexing/user.yaml b/lib/Resources/config/search/common/asynchronous_indexing/user.yaml index ca054664..6b2a095c 100644 --- a/lib/Resources/config/search/common/asynchronous_indexing/user.yaml +++ b/lib/Resources/config/search/common/asynchronous_indexing/user.yaml @@ -1,18 +1,18 @@ services: - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\AssignUserToUserGroupHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\AssignUserToUserGroupHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\UserContentWithLocationIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\UserContentWithLocationIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\BeforeUnAssignUserFromUserGroupHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\BeforeUnAssignUserFromUserGroupHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@ibexa.spi.search' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserGroupHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\CreateUserGroupHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -21,7 +21,7 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\CreateUserHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -31,32 +31,32 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserGroupHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\DeleteUserGroupHandler: arguments: - '@ibexa.spi.search' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\DeleteUserHandler: arguments: - '@ibexa.spi.search' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\MoveUserGroupHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\MoveUserGroupHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\SubtreeIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\SubtreeIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UnAssignUserFromUserGroupHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\UnAssignUserFromUserGroupHandler: arguments: - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\UserContentWithLocationIndexer' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\UserContentWithLocationIndexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserGroupHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\UpdateUserGroupHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -66,7 +66,7 @@ services: - { name: messenger.message_handler } - { name: monolog.logger, channel: ngsearchextra } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserHandler: + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\UpdateUserHandler: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index d942b9f2..912be34a 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -178,85 +178,85 @@ services: arguments: - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\CopyContent': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\CopyContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\CopyContentHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\DeleteContentHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteTranslation': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\DeleteTranslationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\DeleteTranslationHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\HideContent': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\HideContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\HideContentHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\PublishVersion': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\PublishVersionHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\PublishVersionHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\RevealContent': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\RevealContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\RevealContentHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\UpdateContentMetadata': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Content\UpdateContentMetadataHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\UpdateContentMetadataHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\AssignSectionToSubtree': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\AssignSectionToSubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\AssignSectionToSubtreeHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CopySubtree': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CopySubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\CopySubtreeHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CreateLocation': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\CreateLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\CreateLocationHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\DeleteLocation': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\DeleteLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\DeleteLocationHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\HideLocation': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\HideLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\HideLocationHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\MoveSubtree': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\MoveSubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\MoveSubtreeHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\SwapLocation': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\SwapLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\SwapLocationHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UnhideLocation': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UnhideLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\UnhideLocationHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UpdateLocation': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Location\UpdateLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\UpdateLocationHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\ObjectState\SetContentState': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ObjectState\SetContentStateHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\ObjectState\SetContentStateHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Section\AssignSection': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Section\AssignSectionHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Section\AssignSectionHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Recover': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\RecoverHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash\RecoverHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Trash': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\Trash\TrashHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash\TrashHandler' - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\AssignUserToUserGroup': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\AssignUserToUserGroupHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\AssignUserToUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\BeforeUnAssignUserFromUserGroup': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\BeforeUnAssignUserFromUserGroupHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\BeforeUnAssignUserFromUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUserGroup': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserGroupHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\CreateUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\CreateUser': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\CreateUserHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\CreateUserHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUserGroup': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserGroupHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\DeleteUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\DeleteUser': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\DeleteUserHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\DeleteUserHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\MoveUserGroup': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\MoveUserGroupHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\MoveUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UnAssignUserFromUserGroup': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UnAssignUserFromUserGroupHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\UnAssignUserFromUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUserGroup': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserGroupHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\UpdateUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\UpdateUser': - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\User\UpdateUserHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\UpdateUserHandler' netgen_test.ibexa_search_extra.asynchronous_indexing.messenger.middleware: class: Symfony\Component\Messenger\Middleware\HandleMessageMiddleware From 3a2131cea2e2e0bed34423939055f47a65b96601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 12:31:16 +0200 Subject: [PATCH 31/74] NGSTACK-836: restructure parent-child indexing field mapper --- .../{ => ContentTranslation}/ParentChildFieldMapper.php | 7 ++++--- .../ParentChildFieldMapper}/FullTextFieldResolver.php | 2 +- .../FullTextFieldResolver/NativeFulltextFieldResolver.php | 4 ++-- .../config/search/common/parent_child_indexing/common.yaml | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) rename lib/Core/Search/Solr/FieldMapper/{ => ContentTranslation}/ParentChildFieldMapper.php (97%) rename lib/Core/Search/Solr/FieldMapper/{ => ContentTranslation/ParentChildFieldMapper}/FullTextFieldResolver.php (72%) rename lib/Core/Search/Solr/FieldMapper/{ => ContentTranslation/ParentChildFieldMapper}/FullTextFieldResolver/NativeFulltextFieldResolver.php (90%) diff --git a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php similarity index 97% rename from lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php index c6cd7f62..3a571d62 100644 --- a/lib/Core/Search/Solr/FieldMapper/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php @@ -2,13 +2,14 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; 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\Content\Location\Handler as LocationHandler; +use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; +use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler; use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; @@ -16,8 +17,8 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; -use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler; use Ibexa\Contracts\Solr\FieldMapper\ContentTranslationFieldMapper; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; use function array_key_exists; use function array_keys; diff --git a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver.php similarity index 72% rename from lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver.php index 973adc53..8a81e3ef 100644 --- a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; diff --git a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php similarity index 90% rename from lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php index 39e1e1af..d4d0ae3c 100644 --- a/lib/Core/Search/Solr/FieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FullTextFieldResolver; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; @@ -11,7 +11,7 @@ use Ibexa\Contracts\Core\Search\FieldType\FullTextField; use Ibexa\Contracts\Core\Search\FieldType\TextField; use Ibexa\Core\Search\Common\FieldRegistry; -use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FullTextFieldResolver; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; final class NativeFulltextFieldResolver implements FullTextFieldResolver { 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 75642cd1..34a514b4 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -1,6 +1,6 @@ services: netgen_search_extra.parent_child_indexing.parent_child_field_mapper: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ParentChildFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper arguments: - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' @@ -20,7 +20,7 @@ services: - '%netgen.ibexa_search_extra.parent_child_indexer%' netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\FullTextFieldResolver\NativeFulltextFieldResolver + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFulltextFieldResolver arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Core\Search\Common\FieldRegistry' From a470a605e0f64871565b0d27e18632e6b072ef78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 12:36:46 +0200 Subject: [PATCH 32/74] NGSTACK-836: restructure parent-child indexing ancestor resolver --- .../Search/ParentChildIndexing/AncestorIndexer.php | 3 +-- .../Search/ParentChildIndexing/AncestorResolver.php} | 5 ++--- .../config/search/common/parent_child_indexing/common.yaml | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) rename lib/Core/Search/{Solr/ParentChildReindexAncestorResolver.php => Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php} (98%) 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 e07ea30d..51285913 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php @@ -8,14 +8,13 @@ use Ibexa\Contracts\Core\Persistence\Content\Location; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Search\VersatileHandler; -use Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver; final class AncestorIndexer { public function __construct( private readonly VersatileHandler $searchHandler, private readonly ContentHandler $contentHandler, - private readonly ParentChildReindexAncestorResolver $ancestorResolver, + private readonly AncestorResolver $ancestorResolver, ) {} public function indexSingle(Location $location): void diff --git a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php similarity index 98% rename from lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php index 1926892f..6b5ad02e 100644 --- a/lib/Core/Search/Solr/ParentChildReindexAncestorResolver.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php @@ -2,14 +2,13 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; - use function array_merge; use function array_shift; use function count; @@ -21,7 +20,7 @@ use function mb_strlen; use function str_starts_with; -final class ParentChildReindexAncestorResolver +final class AncestorResolver { /** * @var string[]|null 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 34a514b4..8db6c00e 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -11,8 +11,8 @@ services: tags: - { name: ibexa.search.solr.field.mapper.content.translation } - netgen_search_extra.parent_child_indexing.parent_child_reindex_ancestor_resolver: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\ParentChildReindexAncestorResolver + netgen_search_extra.parent_child_indexing.ancestor_resolver: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorResolver arguments: - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' @@ -33,4 +33,4 @@ services: arguments: - '@Ibexa\Contracts\Core\Search\VersatileHandler' - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - - '@netgen_search_extra.parent_child_indexing.parent_child_reindex_ancestor_resolver' + - '@netgen_search_extra.parent_child_indexing.ancestor_resolver' From d748ae0344f37e9d29db72aa0207168938d299cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 12:45:53 +0200 Subject: [PATCH 33/74] NGSTACK-836: fix test service configuration --- .../config/event_dispatcher_override_asynchronous.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 912be34a..911f0714 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -1,6 +1,6 @@ services: netgen_search_extra.parent_child_indexing.parent_child_field_mapper: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ParentChildFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper arguments: - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' From 1d6bb196f63aea4620e03c33ae76d8c7368f3b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Wed, 29 May 2024 13:14:31 +0200 Subject: [PATCH 34/74] NGSTACK-836: add parent-child indexing test for publishing version --- .../API/ParentChildIndexingTest.php | 77 +++++++++++++++++++ ...vent_dispatcher_override_asynchronous.yaml | 9 ++- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 tests/lib/Integration/API/ParentChildIndexingTest.php diff --git a/tests/lib/Integration/API/ParentChildIndexingTest.php b/tests/lib/Integration/API/ParentChildIndexingTest.php new file mode 100644 index 00000000..e638ef9f --- /dev/null +++ b/tests/lib/Integration/API/ParentChildIndexingTest.php @@ -0,0 +1,77 @@ +getRepository(); + $contentService = $repository->getContentService(); + $contentTypeService = $repository->getContentTypeService(); + $locationService = $repository->getLocationService(); + $searchService = $repository->getSearchService(); + + $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct('parent_child_test'); + $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; + $contentTypeCreateStruct->names = ['eng-GB' => 'Article']; + $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); + $fieldDefinitionCreateStruct->position = 0; + $fieldDefinitionCreateStruct->isSearchable = true; + $contentTypeCreateStruct->addFieldDefinition($fieldDefinitionCreateStruct); + $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); + $contentTypeService->publishContentTypeDraft($contentTypeDraft); + + $contentType = $contentTypeService->loadContentTypeByIdentifier('parent_child_test'); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'mogoruš'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $parentContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $parentLocation = $parentContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'šćenac'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $contentService->publishVersion($contentDraft->versionInfo); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($parentContentCreated->id), + new Query\Criterion\FullText('šćenac'), + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(1, $searchResult->totalCount); + + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals($parentContentFound->id, $parentContentCreated->id); + } +} diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 911f0714..481435df 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -1,3 +1,10 @@ +parameters: + netgen.ibexa_search_extra.parent_child_indexer: + parent_child_test: + children: + parent_child_test: + indexed: true + services: netgen_search_extra.parent_child_indexing.parent_child_field_mapper: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper @@ -9,7 +16,7 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '%netgen.ibexa_search_extra.parent_child_indexer%' tags: - - { name: messenger.message_handler } + - { name: ibexa.search.solr.field.mapper.block.translation } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler From 6652b1d6bca078baa05b33825b20b9a9715ac4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Fri, 31 May 2024 11:26:58 +0200 Subject: [PATCH 35/74] NGSTACK-836: fix CS --- lib/Container/Compiler/ParentChildIndexingPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Container/Compiler/ParentChildIndexingPass.php b/lib/Container/Compiler/ParentChildIndexingPass.php index cb37b0fa..460f254b 100644 --- a/lib/Container/Compiler/ParentChildIndexingPass.php +++ b/lib/Container/Compiler/ParentChildIndexingPass.php @@ -12,7 +12,7 @@ class ParentChildIndexingPass implements CompilerPassInterface private const ParentChildIndexerTag = 'netgen.parent_child_indexer.message_handler'; private const MessageHandlerTag = 'messenger.message_handler'; - public function process(ContainerBuilder $container) :void + public function process(ContainerBuilder $container): void { $useParentChildIndexing = $container->getParameter( 'netgen_ibexa_search_extra.use_parent_child_indexing', From fe149f46fae78d4f374aba429a456de7fed95da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Fri, 31 May 2024 11:28:14 +0200 Subject: [PATCH 36/74] NGSTACK-836: update test class name --- tests/lib/Integration/API/ParentChildIndexingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Integration/API/ParentChildIndexingTest.php b/tests/lib/Integration/API/ParentChildIndexingTest.php index e638ef9f..bd150da0 100644 --- a/tests/lib/Integration/API/ParentChildIndexingTest.php +++ b/tests/lib/Integration/API/ParentChildIndexingTest.php @@ -33,7 +33,7 @@ public function testPublishVersion(): void $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct('parent_child_test'); $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; - $contentTypeCreateStruct->names = ['eng-GB' => 'Article']; + $contentTypeCreateStruct->names = ['eng-GB' => 'Parent child test']; $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); $fieldDefinitionCreateStruct->position = 0; $fieldDefinitionCreateStruct->isSearchable = true; From 26c1bc4ee4308ab9d46b284f4042031df835b18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Fri, 31 May 2024 11:32:14 +0200 Subject: [PATCH 37/74] NGSTACK-836: rename parent-child indexing fulltext field mapper --- ...php => ParentChildFullTextFieldMapper.php} | 2 +- .../common/parent_child_indexing/common.yaml | 22 +++++++++---------- ...vent_dispatcher_override_asynchronous.yaml | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/{ParentChildFieldMapper.php => ParentChildFullTextFieldMapper.php} (98%) diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php similarity index 98% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php index 3a571d62..f4181112 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php @@ -25,7 +25,7 @@ use function array_merge; use function count; -final class ParentChildFieldMapper extends ContentTranslationFieldMapper +final class ParentChildFullTextFieldMapper extends ContentTranslationFieldMapper { /** * @var array 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 8db6c00e..a6ceed82 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -1,6 +1,15 @@ services: - netgen_search_extra.parent_child_indexing.parent_child_field_mapper: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper + netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFulltextFieldResolver + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + - '@Ibexa\Core\Search\Common\FieldRegistry' + + netgen_search_extra.parent_child_indexing.fulltext_field_resolver: + alias: netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native + + netgen_search_extra.parent_child_indexing.field_mapper.fulltext: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFullTextFieldMapper arguments: - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' @@ -19,15 +28,6 @@ services: - '@Ibexa\Core\Persistence\Cache\LocationHandler' - '%netgen.ibexa_search_extra.parent_child_indexer%' - netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFulltextFieldResolver - arguments: - - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - - '@Ibexa\Core\Search\Common\FieldRegistry' - - netgen_search_extra.parent_child_indexing.fulltext_field_resolver: - alias: netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native - netgen_search_extra.parent_child_indexing.ancestor_indexer: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer arguments: diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 481435df..07ece717 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -6,8 +6,8 @@ parameters: indexed: true services: - netgen_search_extra.parent_child_indexing.parent_child_field_mapper: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper + netgen_search_extra.parent_child_indexing.field_mapper.fulltext: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFullTextFieldMapper arguments: - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' From ed1932c91bb2f9cb210a0e28a442cb92bb3deca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Fri, 31 May 2024 12:10:39 +0200 Subject: [PATCH 38/74] NGSTACK-836: make parent-child fulltext field mapper configurable --- bundle/DependencyInjection/Configuration.php | 6 +++++- .../NetgenIbexaSearchExtraExtension.php | 5 +++++ lib/Container/Compiler/ParentChildIndexingPass.php | 14 ++++++++++++++ .../common/parent_child_indexing/common.yaml | 2 +- .../event_dispatcher_override_asynchronous.yaml | 2 +- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/bundle/DependencyInjection/Configuration.php b/bundle/DependencyInjection/Configuration.php index 61c9b663..644a5124 100644 --- a/bundle/DependencyInjection/Configuration.php +++ b/bundle/DependencyInjection/Configuration.php @@ -256,7 +256,11 @@ private function addParentChildIndexingSection(ArrayNodeDefinition $nodeDefiniti $nodeDefinition ->children() ->booleanNode('use_parent_child_indexing') - ->info('Use parent child indexing') + ->info('Use parent-child indexing') + ->defaultFalse() + ->end() + ->booleanNode('parent_child_indexing_use_default_solr_fulltext_field_mapper') + ->info('Use parent-child indexing default Solr fulltext field mapper') ->defaultFalse() ->end() ->end(); diff --git a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php index 5fdb830c..89284c76 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -165,5 +165,10 @@ private function processParentChildIndexingConfiguration(array $configuration, C 'netgen_ibexa_search_extra.use_parent_child_indexing', $configuration['use_parent_child_indexing'], ); + + $container->setParameter( + 'netgen_ibexa_search_extra.parent_child_indexing_use_default_solr_fulltext_field_mapper', + $configuration['parent_child_indexing_use_default_solr_fulltext_field_mapper'], + ); } } diff --git a/lib/Container/Compiler/ParentChildIndexingPass.php b/lib/Container/Compiler/ParentChildIndexingPass.php index 460f254b..da336788 100644 --- a/lib/Container/Compiler/ParentChildIndexingPass.php +++ b/lib/Container/Compiler/ParentChildIndexingPass.php @@ -28,5 +28,19 @@ public function process(ContainerBuilder $container): void $definition = $container->getDefinition($serviceId); $definition->addTag(self::MessageHandlerTag); } + + $parentChildIndexingUseDefaultSolrFullTextFieldMapper = $container->getParameter( + 'netgen_ibexa_search_extra.parent_child_indexing_use_default_solr_fulltext_field_mapper', + ); + + if ($parentChildIndexingUseDefaultSolrFullTextFieldMapper !== true) { + return; + } + + $solrFullTextFieldMapper = $container->getDefinition( + 'netgen_search_extra.parent_child_indexing.field_mapper.fulltext' + ); + + $solrFullTextFieldMapper->addTag('ibexa.search.solr.field.mapper.content.translation'); } } 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 a6ceed82..09b9497f 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -18,7 +18,7 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '%netgen.ibexa_search_extra.parent_child_indexer%' tags: - - { name: ibexa.search.solr.field.mapper.content.translation } + - { name: ibexa.search.solr.field.mapper.content.translation.disabled } netgen_search_extra.parent_child_indexing.ancestor_resolver: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorResolver diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 07ece717..4b7eac5d 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -16,7 +16,7 @@ services: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '%netgen.ibexa_search_extra.parent_child_indexer%' tags: - - { name: ibexa.search.solr.field.mapper.block.translation } + - { name: ibexa.search.solr.field.mapper.content.translation } Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler From b1b85ab410943dca9aef41ac6a65c10981d08a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Mon, 3 Jun 2024 13:39:26 +0200 Subject: [PATCH 39/74] NGSTACK-836: implement recursive semantic config --- bundle/DependencyInjection/Configuration.php | 116 +++- .../NetgenIbexaSearchExtraExtensionTest.php | 606 ++++++++++++++++++ 2 files changed, 717 insertions(+), 5 deletions(-) diff --git a/bundle/DependencyInjection/Configuration.php b/bundle/DependencyInjection/Configuration.php index 644a5124..96fa7f67 100644 --- a/bundle/DependencyInjection/Configuration.php +++ b/bundle/DependencyInjection/Configuration.php @@ -7,6 +7,7 @@ use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use function array_keys; use function is_string; @@ -32,6 +33,7 @@ public function getConfigTreeBuilder(): TreeBuilder $this->addUsePageIndexingSection($rootNode); $this->addPageIndexingSection($rootNode); $this->addParentChildIndexingSection($rootNode); + $this->addHierarchicalIndexingSection($rootNode); return $treeBuilder; } @@ -53,7 +55,7 @@ private function addIndexableFieldTypeSection(ArrayNodeDefinition $nodeDefinitio ->info("Maximum number of characters for the indexed short text ('value' string type field)") ->defaultValue(256) ->end() - ->end() + ?->end() ->end() ->end() ->end() @@ -69,7 +71,7 @@ private function addSearchResultExtractorSection(ArrayNodeDefinition $nodeDefini ->info('Get search result objects by loading them from the persistence layer, instead of reconstructing them from the returned Solr data') ->defaultTrue() ->end() - ->end(); + ?->end(); } private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinition): void @@ -81,7 +83,7 @@ private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinit ->info('Use asynchronous mechanism to handle repository content indexing') ->defaultFalse() ->end() - ->end(); + ?->end(); } private function addFulltextBoostSection(ArrayNodeDefinition $nodeDefinition): void @@ -259,10 +261,114 @@ private function addParentChildIndexingSection(ArrayNodeDefinition $nodeDefiniti ->info('Use parent-child indexing') ->defaultFalse() ->end() - ->booleanNode('parent_child_indexing_use_default_solr_fulltext_field_mapper') + ?->booleanNode('parent_child_indexing_use_default_solr_fulltext_field_mapper') ->info('Use parent-child indexing default Solr fulltext field mapper') ->defaultFalse() ->end() - ->end(); + ?->end(); + } + + private function addHierarchicalIndexingSection(ArrayNodeDefinition $nodeDefinition): void + { + $childrenNodeDefinition = $nodeDefinition + ->children() + ->arrayNode('hierarchical_indexing') + ->info('Hierarchical indexing configuration') + ->addDefaultsIfNotSet() + ->children() + ->arrayNode('descendant_indexing') + ->info('Descendant indexing configuration') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('enabled') + ->info('Enable/disable descendant indexing') + ->defaultFalse() + ->end() + ?->arrayNode('map') + ->useAttributeAsKey('name') + ->normalizeKeys(false) + ->arrayPrototype() + ->children() + ->arrayNode('handlers') + ->info('List of indexing handlers to execute') + ->example([ + 'handler_identifier_1', + 'handler_identifier_2', + ]) + ->scalarPrototype() + ->defaultValue([]) + ->validate() + ->ifTrue(fn ($v) => !is_string($v)) + ->thenInvalid('Handler identifier must be a string.') + ->end() + ->end() + ?->end() + ?->arrayNode('children') + ->useAttributeAsKey('name') + ->normalizeKeys(false) + ->arrayPrototype() + ; + + $this->buildChildrenNode($childrenNodeDefinition); + } + + private function evaluateChildren(&$child, $name): void + { + $builder = new TreeBuilder($name, 'array'); + $root = $builder->getRootNode(); + + $this->buildChildrenNode($root); + + $root->getNode(true)->finalize($child); + } + + private function buildChildrenNode(ArrayNodeDefinition $node): void + { + $node + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('indexed') + ->info('Whether the node should be indexed') + ->defaultTrue() + ->end() + ?->variableNode('children') + ->defaultValue([]) + ->validate() + ->ifTrue(fn ($v) => !is_array($v)) + ->thenInvalid('The children element must be an array.') + ->end() + ->validate() + ->always( + function ($children) { + array_walk($children, $this->evaluateChildren(...)); + + return $children; + } + ) + ->end() + ->end() + ?->end() + ->validate() + ->always( + function ($children) { + foreach (array_keys($children) as $key) { + $allowedOptions = ['indexed', 'children']; + + if (!in_array($key, $allowedOptions, true)) { + throw new InvalidConfigurationException( + sprintf( + 'Unrecognized option "%s". Available options are "%s".', + $key, + implode('", "', $allowedOptions), + ), + ); + } + } + + return $children; + } + ) + ->end() + ; } } diff --git a/tests/bundle/DependencyInjection/NetgenIbexaSearchExtraExtensionTest.php b/tests/bundle/DependencyInjection/NetgenIbexaSearchExtraExtensionTest.php index 4a8af81a..e14626f5 100644 --- a/tests/bundle/DependencyInjection/NetgenIbexaSearchExtraExtensionTest.php +++ b/tests/bundle/DependencyInjection/NetgenIbexaSearchExtraExtensionTest.php @@ -784,6 +784,612 @@ public function testInvalidPageIndexingConfiguration(array $siteRootsConfig): vo $this->load($siteRootsConfig); } + public function providerForTestHierarchicalIndexingConfiguration(): array + { + return [ + [ + [ + 'hierarchical_indexing' => false, + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => false, + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'mogoruš' => [], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => 'yes', + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => true, + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'mogoruš' => true, + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => 1, + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'mogoruš' => [], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => 2, + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'children' => 3, + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'mogoruš' => 3, + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'children' => [], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => false, + 'children' => [], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [], + 'children' => [], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + false, + ], + 'children' => [], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + ], + 'children' => [], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => 4, + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [], + ], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => [], + ], + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'mogoruš' => [], + ], + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => false, + ], + ], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => 'many', + ], + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [], + ], + ], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [ + 'content_type_identifier' => 7, + ], + ], + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [ + 'content_type_identifier' => [], + ], + ], + ], + ], + ], + ], + ], + ], + true, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => 8, + ], + ], + ], + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'handlers' => [], + 'indexed' => true, + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [], + ], + ], + ], + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [ + 'content_type_identifier' => [ + 'handlers' => [], + 'indexed' => true, + 'children' => [], + ], + ], + ], + ], + ], + ], + ], + ], + ], + false, + ], + [ + [ + 'hierarchical_indexing' => [ + 'descendant_indexing' => [ + 'enabled' => false, + 'map' => [ + 'content_type_identifier' => [ + 'handlers' => [ + 'handler_identifier_1', + 'handler_identifier_2', + ], + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [ + 'content_type_identifier' => [ + 'indexed' => true, + 'children' => [], + ], + ], + ], + ], + ], + ], + ], + ], + ], + true, + ], + ]; + } + + /** + * @dataProvider providerForTestHierarchicalIndexingConfiguration + */ + public function testHierarchicalIndexingInvalidConfiguration(array $configuration, bool $valid): void + { + if (!$valid) { + $this->expectException(InvalidConfigurationException::class); + } else { + $this->addToAssertionCount(1); + } + + $this->load($configuration); + } + protected function getContainerExtensions(): array { return [ From eac31db978b1376890a33c120d562684711dc0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 4 Jun 2024 09:56:14 +0200 Subject: [PATCH 40/74] NGSTACK-836: extract AncestorPathGenerator with test --- .../AncestorPathGenerator.php | 143 ++++++++++++++ .../ParentChildIndexing/AncestorResolver.php | 140 +------------- .../common/parent_child_indexing/common.yaml | 5 + .../AncestorPathGeneratorTest.php | 176 ++++++++++++++++++ 4 files changed, 330 insertions(+), 134 deletions(-) create mode 100644 lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorPathGenerator.php create mode 100644 tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorPathGenerator.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorPathGenerator.php new file mode 100644 index 00000000..e9597669 --- /dev/null +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorPathGenerator.php @@ -0,0 +1,143 @@ +paths === null) { + $normalizedConfiguration = $this->normalizeConfiguration($this->configuration['map'] ?? []); + $paths = $this->recursiveFlattenPaths($normalizedConfiguration); + $this->paths = $this->expandPaths($paths); + } + + return $this->paths; + } + + /** + * @param string[] $paths + * + * @return string[] + */ + private function expandPaths(array $paths): array + { + $expandedPathsGrouped = [[]]; + + foreach ($paths as $path) { + $expandedPathsGrouped[] = $this->recursiveExpandPath(explode('/', $path)); + } + + return array_merge(...$expandedPathsGrouped); + } + + /** + * @param string[] $pathElements + * + * @return string[] + */ + private function recursiveExpandPath(array $pathElements): array + { + $expandedPaths = []; + + if (count($pathElements) > 1) { + $path = implode('/', $pathElements); + array_shift($pathElements); + + $expandedPaths = [ + $path, + ...$expandedPaths, + ...$this->recursiveExpandPath($pathElements), + ]; + } + + return $expandedPaths; + } + + /** + * @param array $config + * + * @return string[] + */ + private function recursiveFlattenPaths(array $config, string $path = ''): array + { + $paths = []; + + foreach ($config as $key => $value) { + if (is_array($value) && count($value) > 0) { + $paths = [ + ...$paths, + ...$this->recursiveFlattenPaths($value, '/' . $key . $path), + ]; + + continue; + } + + $paths[] = $key . $path; + } + + return $paths; + } + + /** + * @param array $config + * + * @return array + */ + private function normalizeConfiguration(array $config): array + { + $normalizedConfig = []; + + foreach ($config as $key => $value) { + $normalizedConfig[$key] = $this->recursiveNormalizeConfiguration($value); + } + + return $normalizedConfig; + } + + /** + * @param array $config + * + * @return array + */ + private function recursiveNormalizeConfiguration(array $config): array + { + $normalizedConfig = []; + + foreach ($config as $key => $value) { + if ($key === 'indexed') { + continue; + } + + if ($key === 'children') { + return $this->recursiveNormalizeConfiguration($value); + } + + $normalizedConfig[$key] = $this->recursiveNormalizeConfiguration($value); + } + + return $normalizedConfig; + } +} diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php index 6b5ad02e..94901d04 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php @@ -9,37 +9,25 @@ use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; -use function array_merge; -use function array_shift; -use function count; + use function end; -use function explode; use function implode; -use function is_array; use function is_int; use function mb_strlen; use function str_starts_with; final class AncestorResolver { - /** - * @var string[]|null - */ - private ?array $paths = null; - /** * @var array */ private array $contentIdContentTypeIdentifierCache = []; - /** - * @param array $configuration - */ public function __construct( private readonly ContentHandler $contentHandler, private readonly ContentTypeHandler $contentTypeHandler, private readonly LocationHandler $locationHandler, - private readonly array $configuration, + private readonly AncestorPathGenerator $ancestorPathGenerator, ) {} public function resolveAncestor(Location $location): ?Location @@ -68,7 +56,7 @@ public function resolveAncestorForParentLocation(Location $location): ?Location return null; } - foreach ($this->getPaths() as $path) { + foreach ($this->ancestorPathGenerator->getPaths() as $path) { if (str_ends_with($path, $contentTypeIdentifier)) { return $location; } @@ -85,10 +73,12 @@ public function resolveAncestorForParentLocation(Location $location): ?Location private function matchPath(array $ancestry): false|int { $ancestryPath = $this->getAncestryPath($ancestry); + if ($ancestryPath === null) { return false; } - foreach ($this->getPaths() as $path) { + + foreach ($this->ancestorPathGenerator->getPaths() as $path) { if (str_starts_with($path, $ancestryPath)) { return mb_strlen($path) - mb_strlen($ancestryPath); } @@ -162,122 +152,4 @@ private function getContentTypeIdentifier(Location $location): string return $this->contentIdContentTypeIdentifierCache[$contentId]; } - - /** - * @return string[] - */ - private function getPaths(): array - { - if ($this->paths === null) { - $normalizedConfiguration = $this->normalizeConfiguration($this->configuration); - $paths = $this->recursiveFlattenPaths($normalizedConfiguration); - $this->paths = $this->expandPaths($paths); - } - - return $this->paths; - } - - /** - * @param string[] $paths - * - * @return string[] - */ - private function expandPaths(array $paths): array - { - $expandedPathsGrouped = [[]]; - - foreach ($paths as $path) { - $expandedPathsGrouped[] = $this->recursiveExpandPath(explode('/', $path)); - } - - return array_merge(...$expandedPathsGrouped); - } - - /** - * @param string[] $pathElements - * - * @return string[] - */ - private function recursiveExpandPath(array $pathElements): array - { - $expandedPaths = []; - - if (count($pathElements) > 1) { - $path = implode('/', $pathElements); - array_shift($pathElements); - - $expandedPaths = [ - $path, - ...$expandedPaths, - ...$this->recursiveExpandPath($pathElements), - ]; - } - - return $expandedPaths; - } - - /** - * @param array $config - * - * @return string[] - */ - private function recursiveFlattenPaths(array $config, string $path = ''): array - { - $paths = []; - - foreach ($config as $key => $value) { - if (is_array($value) && count($value) > 0) { - $paths = [ - ...$paths, - ...$this->recursiveFlattenPaths($value, '/' . $key . $path), - ]; - - continue; - } - - $paths[] = $key . $path; - } - - return $paths; - } - - /** - * @param array $config - * - * @return array - */ - private function normalizeConfiguration(array $config): array - { - $normalizedConfig = []; - - foreach ($config as $key => $value) { - $normalizedConfig[$key] = $this->recursiveNormalizeConfiguration($value); - } - - return $normalizedConfig; - } - - /** - * @param array $config - * - * @return array - */ - private function recursiveNormalizeConfiguration(array $config): array - { - $normalizedConfig = []; - - foreach ($config as $key => $value) { - if ($key === 'indexed') { - continue; - } - - if ($key === 'children') { - return $this->recursiveNormalizeConfiguration($value); - } - - $normalizedConfig[$key] = $this->recursiveNormalizeConfiguration($value); - } - - return $normalizedConfig; - } } 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 09b9497f..580f6acc 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -20,6 +20,11 @@ services: tags: - { name: ibexa.search.solr.field.mapper.content.translation.disabled } + netgen_search_extra.parent_child_indexing.ancestor_path_generator: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorPathGenerator + arguments: + - '%netgen.ibexa_search_extra.parent_child_indexer%' + netgen_search_extra.parent_child_indexing.ancestor_resolver: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorResolver arguments: diff --git a/tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php new file mode 100644 index 00000000..ea002f74 --- /dev/null +++ b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php @@ -0,0 +1,176 @@ + true, + ], + [], + ], + [ + [ + 'enabled' => true, + 'map' => [], + ], + [], + ], + [ + [ + 'enabled' => true, + 'map' => [ + 'cti_1' => [], + ], + ], + [], + ], + [ + [ + 'enabled' => true, + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'indexed' => true, + 'cti_2' => [], + ], + ], + ], + ], + [ + 'cti_2/cti_1', + ], + ], + [ + [ + 'enabled' => true, + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'indexed' => false, + 'cti_2' => [], + ], + ], + ], + ], + [ + 'cti_2/cti_1', + ], + ], + [ + [ + 'enabled' => true, + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'indexed' => false, + 'cti_2' => [ + 'children' => [ + 'indexed' => false, + 'cti_3' => [], + ], + ], + ], + ], + ], + ], + [ + 'cti_3/cti_2/cti_1', + 'cti_2/cti_1', + ], + ], + [ + [ + 'enabled' => true, + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'indexed' => false, + 'cti_2' => [ + 'children' => [ + 'indexed' => false, + 'cti_3' => [ + 'children' => [ + 'cti_4' => [] + ], + ], + ], + ], + ], + ], + ], + ], + [ + 'cti_4/cti_3/cti_2/cti_1', + 'cti_3/cti_2/cti_1', + 'cti_2/cti_1', + ], + ], + [ + [ + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'cti_2' => [ + 'children' => [ + 'indexed' => false, + 'cti_3' => [], + ], + ], + ], + ], + 'cti_4' => [ + 'children' => [ + 'indexed' => false, + 'cti_2' => [ + 'children' => [ + 'cti_3' => [], + ], + ], + ], + ], + ], + ], + [ + 'cti_3/cti_2/cti_1', + 'cti_2/cti_1', + 'cti_3/cti_2/cti_4', + 'cti_2/cti_4', + ], + ], + ]; + } + + /** + * @dataProvider providerForTestGetPaths + */ + public function testGetPaths(array $configuration, array $expectedPaths): void + { + $generator = $this->getAncestorPathGeneratorUnderTest($configuration); + + $actualPaths = $generator->getPaths(); + + self::assertSame($expectedPaths, $actualPaths); + } + + protected function getAncestorPathGeneratorUnderTest(array $configuration): AncestorPathGenerator + { + return new AncestorPathGenerator($configuration); + } +} From 7ebc3f82967c306618d34d39a24692d8e34ad91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 08:33:45 +0200 Subject: [PATCH 41/74] NGSTACK-836: fix indenting --- .../Content/DeleteContentHandler.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 9e380d1e..df3646d2 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 @@ -42,12 +42,12 @@ public function __invoke(DeleteContent $message): void $locations[] = $this->locationHandler->load($locationId); } catch (NotFoundException) { $this->logger->info( - sprintf( - '%s: Location #%d is gone, aborting', - $this::class, - $locationId, - ), - ); + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $locationId, + ), + ); } } From b8005f68f0cc698afd2edbed8ba87c5bed5deff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 08:34:05 +0200 Subject: [PATCH 42/74] NGSTACK-836: fix logged message --- .../Search/ParentChildIndexing/Content/DeleteContentHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 df3646d2..f85f27d9 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 @@ -26,7 +26,7 @@ public function __invoke(DeleteContent $message): void if (count($message->parentLocationIds) === 0) { $this->logger->info( sprintf( - '%s: Could not find main Location parent Location ID for deleted Content #%d, aborting', + '%s: Could not find parent Location IDs for deleted Content #%d, aborting', $this::class, $message->contentId, ), From bf280457b7908fcc2bb610830ce3bd5773e1fcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 12:51:03 +0200 Subject: [PATCH 43/74] NGSTACK-836: add AncestorResolver unit test --- .../AncestorResolverTest.php | 322 ++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100644 tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php diff --git a/tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php new file mode 100644 index 00000000..8fc67ed2 --- /dev/null +++ b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php @@ -0,0 +1,322 @@ + [ + 'cti_1' => [], + ], + ], + [ + [ + 'id' => 3, + 'parentId' => 2, + 'depth' => 4, + 'contentId' => 3, + 'contentTypeId' => 3, + 'contentTypeIdentifier' => 'cti_3', + ], + ], + 3, + null, + ], + [ + [ + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'cti_2' => [], + ], + ], + ], + ], + [ + [ + 'id' => 2, + 'parentId' => 1, + 'depth' => 3, + 'contentId' => 2, + 'contentTypeId' => 2, + 'contentTypeIdentifier' => 'cti_2', + ], + [ + 'id' => 1, + 'parentId' => 0, + 'depth' => 2, + 'contentId' => 1, + 'contentTypeId' => 1, + 'contentTypeIdentifier' => 'cti_1', + ], + ], + 2, + 1, + ], + [ + [ + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'cti_2' => [], + ], + ], + ], + ], + [ + [ + 'id' => 2, + 'parentId' => 1, + 'depth' => 3, + 'contentId' => 2, + 'contentTypeId' => 2, + 'contentTypeIdentifier' => 'cti_2', + ], + [ + 'id' => 1, + 'parentId' => 0, + 'depth' => 2, + 'contentId' => 1, + 'contentTypeId' => 1, + 'contentTypeIdentifier' => 'cti_5', + ], + ], + 2, + null, + ], + [ + [ + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'cti_2' => [ + 'children' => [ + 'cti_3' => [], + ], + ], + ], + ], + ], + ], + [ + [ + 'id' => 2, + 'parentId' => 1, + 'depth' => 3, + 'contentId' => 2, + 'contentTypeId' => 2, + 'contentTypeIdentifier' => 'cti_2', + ], + [ + 'id' => 1, + 'parentId' => 0, + 'depth' => 2, + 'contentId' => 1, + 'contentTypeId' => 1, + 'contentTypeIdentifier' => 'cti_1', + ], + ], + 2, + 1, + ], + [ + [ + 'map' => [ + 'cti_1' => [ + 'children' => [ + 'cti_2' => [ + 'children' => [ + 'cti_3' => [], + ], + ], + ], + ], + ], + ], + [ + [ + 'id' => 3, + 'parentId' => 2, + 'depth' => 4, + 'contentId' => 3, + 'contentTypeId' => 3, + 'contentTypeIdentifier' => 'cti_3', + ], + [ + 'id' => 2, + 'parentId' => 1, + 'depth' => 3, + 'contentId' => 2, + 'contentTypeId' => 2, + 'contentTypeIdentifier' => 'cti_2', + ], + [ + 'id' => 1, + 'parentId' => 0, + 'depth' => 2, + 'contentId' => 1, + 'contentTypeId' => 1, + 'contentTypeIdentifier' => 'cti_1', + ], + ], + 3, + 1, + ], + ]; + } + + /** + * @dataProvider providerForTestResolveAncestor + */ + public function testResolveAncestor( + array $configuration, + array $locationRepositoryData, + int $initialLocationId, + ?int $expectedAncestor, + ): void { + $resolver = $this->getAncestorResolverUnderTest($configuration, $locationRepositoryData); + + $locationStub = $this->getLocationStubFromRepositoryData($initialLocationId, $locationRepositoryData); + + $actualAncestor = $resolver->resolveAncestor($locationStub); + + if ($expectedAncestor === null) { + $this->assertNull($actualAncestor); + + return; + } + + $this->assertInstanceOf(Location::class, $actualAncestor); + $this->assertSame($expectedAncestor, $actualAncestor->id); + } + + protected function getAncestorResolverUnderTest(array $configuration, array $locationRepositoryData): AncestorResolver + { + return new AncestorResolver( + $this->getContentHandlerMock($locationRepositoryData), + $this->getContentTypeHandlerMock($locationRepositoryData), + $this->getLocationHandlerMock($locationRepositoryData), + new AncestorPathGenerator($configuration), + ); + } + + protected function getContentHandlerMock(array $locationRepositoryData): ContentHandlerInterface|MockObject + { + $mock = $this->getMockBuilder(ContentHandlerInterface::class)->getMock(); + $contentIdToContentTypeIdMap = []; + + foreach ($locationRepositoryData as $data) { + $contentIdToContentTypeIdMap[$data['contentId']] = $data['contentTypeId']; + } + + $mock->method('loadContentInfo')->willReturnCallback( + function ($id) use ($contentIdToContentTypeIdMap) { + foreach ($contentIdToContentTypeIdMap as $contentId => $contentTypeId) { + if ($id === $contentId) { + return new ContentInfo([ + 'contentTypeId' => $contentTypeId, + ]); + } + } + + throw new NotFoundException('ContentInfo', $id); + } + ); + + return $mock; + } + + protected function getContentTypeHandlerMock(array $locationRepositoryData): ContentTypeHandlerInterface|MockObject + { + $mock = $this->getMockBuilder(ContentTypeHandlerInterface::class)->getMock(); + $contentTypeIdToContentTypeIdentifierMap = []; + + foreach ($locationRepositoryData as $data) { + $contentTypeIdToContentTypeIdentifierMap[$data['contentTypeId']] = $data['contentTypeIdentifier']; + } + + $mock->method('load')->willReturnCallback( + function ($id) use ($contentTypeIdToContentTypeIdentifierMap) { + foreach ($contentTypeIdToContentTypeIdentifierMap as $contentTypeId => $contentTypeIdentifier) { + if ($id === $contentTypeId) { + return new Type([ + 'identifier' => $contentTypeIdentifier, + ]); + } + } + + throw new NotFoundException('ContentType', $id); + } + ); + + return $mock; + } + + protected function getLocationHandlerMock(array $locationRepositoryData): LocationHandlerInterface|MockObject + { + $mock = $this->getMockBuilder(LocationHandlerInterface::class)->getMock(); + + $mock->method('load')->willReturnCallback( + function ($id) use ($locationRepositoryData) { + foreach ($locationRepositoryData as $data) { + if ($id === $data['id']) { + return $this->getLocationStub($data); + } + } + + throw new NotFoundException('Location', $id); + } + ); + + return $mock; + } + + protected function getLocationStubFromRepositoryData(int $id, array $locationRepositoryData): Location + { + foreach ($locationRepositoryData as $data) { + if ($id === $data['id']) { + return $this->getLocationStub($data); + } + } + + throw new RuntimeException( + sprintf( + 'Missing Location #%s data', + $id, + ), + ); + } + + protected function getLocationStub(array $locationData): Location + { + return new Location([ + 'id' => $locationData['id'], + 'parentId' => $locationData['parentId'], + 'depth' => $locationData['depth'], + 'contentId' => $locationData['contentId'], + ]); + } +} From 412f70ec01872bafeb81683830c4c5339112097f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 13:07:05 +0200 Subject: [PATCH 44/74] NGSTACK-836: disable hierarchical indexing on legacy and asynchronous Solr --- phpunit-integration-legacy.xml | 1 + phpunit-integration-solr.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/phpunit-integration-legacy.xml b/phpunit-integration-legacy.xml index d5f39c8e..142ace6f 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -20,6 +20,7 @@ tests/lib/Integration/API/SubdocumentQueryCriterionTest.php tests/lib/Integration/API/FulltextSpellcheckCriterionTest.php tests/lib/Integration/API/ExtraFieldsTest.php + tests/lib/Integration/API/ParentChildIndexingTest.php tests/lib/Integration/Solr/RawFacetDomainTest.php tests/lib/Integration/Solr/RawFacetTest.php diff --git a/phpunit-integration-solr.xml b/phpunit-integration-solr.xml index fde478f8..6ca99c41 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -19,6 +19,7 @@ ./bundle ./lib + tests/lib/Integration/API/ParentChildIndexingTest.php From 595f090687fadef74bfd096598f0600c05a6b32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 13:21:59 +0200 Subject: [PATCH 45/74] NGSTACK-836: fix exclude configuration --- phpunit-integration-solr.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit-integration-solr.xml b/phpunit-integration-solr.xml index 6ca99c41..5188da78 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -13,13 +13,13 @@ ./tests/lib/Integration/ + tests/lib/Integration/API/ParentChildIndexingTest.php ./bundle ./lib - tests/lib/Integration/API/ParentChildIndexingTest.php From e2c96c5b5f5505d53120f3863692053eca517cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 13:45:52 +0200 Subject: [PATCH 46/74] NGSTACK-836: fix service configuration --- .../config/search/common/parent_child_indexing/common.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 580f6acc..310c1df4 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -31,7 +31,7 @@ services: - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Core\Persistence\Cache\LocationHandler' - - '%netgen.ibexa_search_extra.parent_child_indexer%' + - '@netgen_search_extra.parent_child_indexing.ancestor_path_generator' netgen_search_extra.parent_child_indexing.ancestor_indexer: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer From 903995ad8b2160575db9af0e64fa7fcad9fbf50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 14:21:39 +0200 Subject: [PATCH 47/74] NGSTACK-836: fix case mismatch --- ...ulltextFieldResolver.php => NativeFullTextFieldResolver.php} | 2 +- .../config/search/common/parent_child_indexing/common.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/{NativeFulltextFieldResolver.php => NativeFullTextFieldResolver.php} (97%) diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php similarity index 97% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php index d4d0ae3c..1cc8dc85 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFulltextFieldResolver.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php @@ -13,7 +13,7 @@ use Ibexa\Core\Search\Common\FieldRegistry; use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; -final class NativeFulltextFieldResolver implements FullTextFieldResolver +final class NativeFullTextFieldResolver implements FullTextFieldResolver { public function __construct( private readonly ContentTypeHandler $contentTypeHandler, 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 310c1df4..c526f2b3 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -1,6 +1,6 @@ services: netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFulltextFieldResolver + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFullTextFieldResolver arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Core\Search\Common\FieldRegistry' From 96b20f3c652d28d6c052b98125137543186adfb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Thu, 6 Jun 2024 14:21:58 +0200 Subject: [PATCH 48/74] NGSTACK-836: update for change in configuration --- .../ParentChildFullTextFieldMapper.php | 4 ++-- .../config/event_dispatcher_override_asynchronous.yaml | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php index f4181112..7d382f34 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php @@ -54,7 +54,7 @@ public function accept(SPIContent $content, $languageCode): bool $contentType = $this->contentTypeHandler->load($contentTypeId); $contentTypeIdentifier = $contentType->identifier; - return array_key_exists($contentTypeIdentifier, $this->configuration); + return array_key_exists($contentTypeIdentifier, $this->configuration['map']); } /** @@ -75,7 +75,7 @@ public function mapFields(SPIContent $content, $languageCode): array return $this->recursiveMapFields( $content->versionInfo->contentInfo, $languageCode, - $this->configuration[$contentTypeIdentifier], + $this->configuration['map'][$contentTypeIdentifier], false, ); } diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 4b7eac5d..b4d74f67 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -1,9 +1,10 @@ parameters: netgen.ibexa_search_extra.parent_child_indexer: - parent_child_test: - children: - parent_child_test: - indexed: true + map: + parent_child_test: + children: + parent_child_test: + indexed: true services: netgen_search_extra.parent_child_indexing.field_mapper.fulltext: From 4a25409fa2173d69dd63b794f8a0321d4b404dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Fri, 7 Jun 2024 13:36:41 +0200 Subject: [PATCH 49/74] NGSTACK-836: implement configurable Solr field handlers for descendant indexing --- .../NetgenIbexaSearchExtraExtension.php | 9 +-- .../Compiler/ParentChildIndexingPass.php | 61 ++++++++++++++----- .../Content/ParentChildFieldMapper.php | 52 ++++++++++++++++ .../BaseFieldMapper.php | 44 +++++++++++++ .../ParentChildFieldMapper.php | 52 ++++++++++++++++ .../BaseFieldMapper.php | 44 +++++++++++++ .../FullTextFieldMapper.php} | 42 ++++++------- .../Location/ParentChildFieldMapper.php | 52 ++++++++++++++++ .../BaseFieldMapper.php | 47 ++++++++++++++ .../search/common/parent_child_indexing.yaml | 2 +- .../common/parent_child_indexing/common.yaml | 33 ++-------- .../common/parent_child_indexing/content.yaml | 42 ++++++------- .../parent_child_indexing/location.yaml | 54 ++++++++-------- .../parent_child_indexing/object_state.yaml | 6 +- .../common/parent_child_indexing/section.yaml | 6 +- .../common/parent_child_indexing/trash.yaml | 12 ++-- .../parent_child_indexing/field_mappers.yaml | 42 +++++++++++++ .../config/search/solr_services.yaml | 1 + ...vent_dispatcher_override_asynchronous.yaml | 61 +++++++++++-------- 19 files changed, 507 insertions(+), 155 deletions(-) create mode 100644 lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper.php create mode 100644 lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper/BaseFieldMapper.php create mode 100644 lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php create mode 100644 lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/BaseFieldMapper.php rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/{ParentChildFullTextFieldMapper.php => ParentChildFieldMapper/FullTextFieldMapper.php} (86%) create mode 100644 lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper.php create mode 100644 lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper/BaseFieldMapper.php create mode 100644 lib/Resources/config/search/solr/parent_child_indexing/field_mappers.yaml diff --git a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php index 89284c76..5edc4915 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -162,13 +162,8 @@ private function processPageIndexingConfiguration(array $configuration, Containe private function processParentChildIndexingConfiguration(array $configuration, ContainerBuilder $container): void { $container->setParameter( - 'netgen_ibexa_search_extra.use_parent_child_indexing', - $configuration['use_parent_child_indexing'], - ); - - $container->setParameter( - 'netgen_ibexa_search_extra.parent_child_indexing_use_default_solr_fulltext_field_mapper', - $configuration['parent_child_indexing_use_default_solr_fulltext_field_mapper'], + 'netgen.ibexa_search_extra.parent_child_indexing.configuration', + $configuration['hierarchical_indexing']['descendant_indexing'], ); } } diff --git a/lib/Container/Compiler/ParentChildIndexingPass.php b/lib/Container/Compiler/ParentChildIndexingPass.php index da336788..4050be06 100644 --- a/lib/Container/Compiler/ParentChildIndexingPass.php +++ b/lib/Container/Compiler/ParentChildIndexingPass.php @@ -6,41 +6,72 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; class ParentChildIndexingPass implements CompilerPassInterface { - private const ParentChildIndexerTag = 'netgen.parent_child_indexer.message_handler'; + private const ParentChildConfigurationParameter = 'netgen.ibexa_search_extra.parent_child_indexing.configuration'; + private const ParentChildMessageHandlerTag = 'netgen.ibexa_search_extra.parent_child_indexing.message_handler'; private const MessageHandlerTag = 'messenger.message_handler'; + private const ParentChildSolrContentFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content'; + private const ParentChildSolrContentFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content'; + private const ParentChildSolrContentTranslationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation'; + private const ParentChildSolrContentTranslationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation'; + private const ParentChildSolrLocationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.location'; + private const ParentChildSolrLocationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.location'; public function process(ContainerBuilder $container): void { - $useParentChildIndexing = $container->getParameter( - 'netgen_ibexa_search_extra.use_parent_child_indexing', - ); + $configuration = $container->getParameter(self::ParentChildConfigurationParameter); + $isEnabled = $configuration['enabled'] ?? false; - if ($useParentChildIndexing !== true) { + if (!$isEnabled) { return; } - $serviceIds =$container->findTaggedServiceIds(self::ParentChildIndexerTag); + $this->registerHandlers($container); + $this->registerSolrContentFieldMappers($container); + $this->registerSolrContentTranslationFieldMappers($container); + $this->registerSolrLocationFieldMappers($container); + } + + private function registerHandlers(ContainerBuilder $container): void + { + $serviceIds = $container->findTaggedServiceIds(self::ParentChildMessageHandlerTag); foreach ($serviceIds as $serviceId => $tag) { $definition = $container->getDefinition($serviceId); $definition->addTag(self::MessageHandlerTag); } + } - $parentChildIndexingUseDefaultSolrFullTextFieldMapper = $container->getParameter( - 'netgen_ibexa_search_extra.parent_child_indexing_use_default_solr_fulltext_field_mapper', - ); + private function registerSolrContentFieldMappers(ContainerBuilder $container): void + { + $definition = $container->getDefinition(self::ParentChildSolrContentFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::ParentChildSolrContentFieldMapperTag); - if ($parentChildIndexingUseDefaultSolrFullTextFieldMapper !== true) { - return; + foreach (array_keys($serviceIds) as $id) { + $definition->addMethodCall('addFieldMapper', [new Reference($id)]); + } + } + + private function registerSolrContentTranslationFieldMappers(ContainerBuilder $container): void + { + $definition = $container->getDefinition(self::ParentChildSolrContentTranslationFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::ParentChildSolrContentTranslationFieldMapperTag); + + foreach (array_keys($serviceIds) as $id) { + $definition->addMethodCall('addFieldMapper', [new Reference($id)]); } + } - $solrFullTextFieldMapper = $container->getDefinition( - 'netgen_search_extra.parent_child_indexing.field_mapper.fulltext' - ); + private function registerSolrLocationFieldMappers(ContainerBuilder $container): void + { + $definition = $container->getDefinition(self::ParentChildSolrLocationFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::ParentChildSolrLocationFieldMapperTag); - $solrFullTextFieldMapper->addTag('ibexa.search.solr.field.mapper.content.translation'); + foreach (array_keys($serviceIds) as $id) { + $definition->addMethodCall('addFieldMapper', [new Reference($id)]); + } } } diff --git a/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper.php new file mode 100644 index 00000000..f3af98cf --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper.php @@ -0,0 +1,52 @@ +fieldMappers as $fieldMapper) { + $this->addFieldMapper($fieldMapper); + } + } + + public function addFieldMapper(BaseFieldMapper $fieldMapper): void + { + $this->fieldMappers[] = $fieldMapper; + } + + public function accept(Content $content): bool + { + return $this->configuration['enabled'] ?? false; + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + public function mapFields(Content $content): array + { + $fieldsGrouped = [[]]; + + foreach ($this->fieldMappers as $fieldMapper) { + if ($fieldMapper->accept($content)) { + $fieldsGrouped[] = $fieldMapper->mapFields($content); + } + } + + return array_merge(...$fieldsGrouped); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper/BaseFieldMapper.php new file mode 100644 index 00000000..dcdd5025 --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper/BaseFieldMapper.php @@ -0,0 +1,44 @@ +internalAccept($content) && $this->doAccept($content); + } + + abstract public function doAccept(Content $content): bool; + + abstract public function getIdentifier(): string; + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + private function internalAccept(Content $content): bool + { + $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); + + $map = $this->configuration['map'] ?? []; + $handlers = $this->configuration['handlers'] ?? []; + + return array_key_exists($contentType->identifier, $map) + && in_array($this->getIdentifier(), $handlers, true); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php new file mode 100644 index 00000000..c5b36f0f --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php @@ -0,0 +1,52 @@ +fieldMappers as $fieldMapper) { + $this->addFieldMapper($fieldMapper); + } + } + + public function addFieldMapper(BaseFieldMapper $fieldMapper): void + { + $this->fieldMappers[] = $fieldMapper; + } + + public function accept(Content $content, $languageCode): bool + { + return $this->configuration['enabled'] ?? false; + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + public function mapFields(Content $content, $languageCode): array + { + $fieldsGrouped = [[]]; + + foreach ($this->fieldMappers as $fieldMapper) { + if ($fieldMapper->accept($content, $languageCode)) { + $fieldsGrouped[] = $fieldMapper->mapFields($content, $languageCode); + } + } + + return array_merge(...$fieldsGrouped); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/BaseFieldMapper.php new file mode 100644 index 00000000..4a7ff4e2 --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/BaseFieldMapper.php @@ -0,0 +1,44 @@ +internalAccept($content) && $this->doAccept($content, $languageCode); + } + + abstract public function doAccept(Content $content, string $languageCode): bool; + + abstract public function getIdentifier(): string; + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + private function internalAccept(Content $content): bool + { + $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); + + $map = $this->configuration['map'] ?? []; + $handlers = $this->configuration['handlers'] ?? []; + + return array_key_exists($contentType->identifier, $map) + && in_array($this->getIdentifier(), $handlers, true); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php similarity index 86% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php index 7d382f34..bfcdd167 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFullTextFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; @@ -20,12 +20,13 @@ use Ibexa\Contracts\Solr\FieldMapper\ContentTranslationFieldMapper; use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\IdentifiableFieldMapper; use function array_key_exists; use function array_keys; use function array_merge; use function count; -final class ParentChildFullTextFieldMapper extends ContentTranslationFieldMapper +final class FullTextFieldMapper extends BaseFieldMapper { /** * @var array @@ -43,18 +44,16 @@ public function __construct( private readonly LocationHandler $locationHandler, private readonly array $configuration, private readonly int $childrenLimit = 99, - ) {} + ) { + parent::__construct( + $contentTypeHandler, + $this->configuration, + ); + } - /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - */ - public function accept(SPIContent $content, $languageCode): bool + public function doAccept(SPIContent $content, $languageCode): bool { - $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; - $contentType = $this->contentTypeHandler->load($contentTypeId); - $contentTypeIdentifier = $contentType->identifier; - - return array_key_exists($contentTypeIdentifier, $this->configuration['map']); + return true; } /** @@ -62,24 +61,27 @@ public function accept(SPIContent $content, $languageCode): bool * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * * @return \Ibexa\Contracts\Core\Search\Field[] */ public function mapFields(SPIContent $content, $languageCode): array { $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; - $contentType = $this->contentTypeHandler->load($contentTypeId); - $contentTypeIdentifier = $contentType->identifier; + $contentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); return $this->recursiveMapFields( $content->versionInfo->contentInfo, $languageCode, - $this->configuration['map'][$contentTypeIdentifier], + $this->configuration['map'][$contentTypeIdentifier] ?? [], false, ); } + public function getIdentifier(): string + { + return 'ng_parent_child_indexing_fulltext'; + } + /** * @param array|null $configuration * @@ -111,11 +113,7 @@ private function recursiveMapFields( foreach ($childrenContentInfoList as $childContentInfo) { $contentTypeId = $childContentInfo->contentTypeId; $contentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); - $childConfiguration = $childrenConfiguration[$contentTypeIdentifier] ?? null; - - if ($childConfiguration === null) { - continue; - } + $childConfiguration = $childrenConfiguration[$contentTypeIdentifier] ?? []; $fieldsGrouped[] = $this->recursiveMapFields( $childContentInfo, @@ -123,6 +121,7 @@ private function recursiveMapFields( $childConfiguration, ); } + return array_merge(...$fieldsGrouped); } @@ -161,6 +160,7 @@ private function loadChildrenContentInfoList( if (count($contentTypeIdentifiers) === 0) { return []; } + $filter = new Filter(); $filter ->withCriterion( diff --git a/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper.php new file mode 100644 index 00000000..cab690fe --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper.php @@ -0,0 +1,52 @@ +fieldMappers as $fieldMapper) { + $this->addFieldMapper($fieldMapper); + } + } + + public function addFieldMapper(BaseFieldMapper $fieldMapper): void + { + $this->fieldMappers[] = $fieldMapper; + } + + public function accept(Location $location): bool + { + return $this->configuration['enabled'] ?? false; + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + public function mapFields(Location $location): array + { + $fieldsGrouped = [[]]; + + foreach ($this->fieldMappers as $fieldMapper) { + if ($fieldMapper->accept($location)) { + $fieldsGrouped[] = $fieldMapper->mapFields($location); + } + } + + return array_merge(...$fieldsGrouped); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper/BaseFieldMapper.php new file mode 100644 index 00000000..5e5c4e1d --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper/BaseFieldMapper.php @@ -0,0 +1,47 @@ +internalAccept($location) && $this->doAccept($location); + } + + abstract public function doAccept(Location $location): bool; + + abstract public function getIdentifier(): string; + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + private function internalAccept(Location $location): bool + { + $contentInfo = $this->contentHandler->loadContentInfo($location->contentId); + $contentType = $this->contentTypeHandler->load($contentInfo->contentTypeId); + + $map = $this->configuration['map'] ?? []; + $handlers = $this->configuration['handlers'] ?? []; + + return array_key_exists($contentType->identifier, $map) + && in_array($this->getIdentifier(), $handlers, true); + } +} diff --git a/lib/Resources/config/search/common/parent_child_indexing.yaml b/lib/Resources/config/search/common/parent_child_indexing.yaml index 22e3d1be..ba53a4b5 100644 --- a/lib/Resources/config/search/common/parent_child_indexing.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing.yaml @@ -7,4 +7,4 @@ imports: - { resource: parent_child_indexing/trash.yaml } parameters: - netgen.ibexa_search_extra.parent_child_indexer: [] + netgen.ibexa_search_extra.parent_child_indexing.configuration: [] 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 c526f2b3..a1cd489c 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/common.yaml @@ -1,41 +1,20 @@ services: - netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFullTextFieldResolver - arguments: - - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - - '@Ibexa\Core\Search\Common\FieldRegistry' - - netgen_search_extra.parent_child_indexing.fulltext_field_resolver: - alias: netgen_search_extra.parent_child_indexing.fulltext_field_resolver.native - - netgen_search_extra.parent_child_indexing.field_mapper.fulltext: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFullTextFieldMapper - arguments: - - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' - - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' - - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '%netgen.ibexa_search_extra.parent_child_indexer%' - tags: - - { name: ibexa.search.solr.field.mapper.content.translation.disabled } - - netgen_search_extra.parent_child_indexing.ancestor_path_generator: + netgen.ibexa_search_extra.parent_child_indexing.ancestor_path_generator: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorPathGenerator arguments: - - '%netgen.ibexa_search_extra.parent_child_indexer%' + - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' - netgen_search_extra.parent_child_indexing.ancestor_resolver: + netgen.ibexa_search_extra.parent_child_indexing.ancestor_resolver: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorResolver arguments: - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Core\Persistence\Cache\LocationHandler' - - '@netgen_search_extra.parent_child_indexing.ancestor_path_generator' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_path_generator' - netgen_search_extra.parent_child_indexing.ancestor_indexer: + netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer arguments: - '@Ibexa\Contracts\Core\Search\VersatileHandler' - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_resolver' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_resolver' diff --git a/lib/Resources/config/search/common/parent_child_indexing/content.yaml b/lib/Resources/config/search/common/parent_child_indexing/content.yaml index 5818c5b5..5f5330c5 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/content.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/content.yaml @@ -1,64 +1,64 @@ services: - netgen_search_extra.parent_child_indexing.copy_content_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.copy_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - netgen_search_extra.parent_child_indexing.delete_content_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.delete_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.delete_translation_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.delete_translation: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.hide_content_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.hide_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - netgen_search_extra.parent_child_indexing.publish_version_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.publish_version: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - netgen_search_extra.parent_child_indexing.reveal_content_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.reveal_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - netgen_search_extra.parent_child_indexing.update_content_metadata_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.update_content_metadata: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } diff --git a/lib/Resources/config/search/common/parent_child_indexing/location.yaml b/lib/Resources/config/search/common/parent_child_indexing/location.yaml index 67c2c630..0fbac02f 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/location.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/location.yaml @@ -1,90 +1,90 @@ services: - netgen_search_extra.parent_child_indexing.assign_section_to_subtree_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.assign_section_to_subtree: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.copy_subtree_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.copy_subtree: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.create_location_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.create_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.delete_location_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.delete_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.hide_location_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.hide_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.move_subtree_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.move_subtree: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.swap_location_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.swap_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.unhide_location_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.unhide_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.update_location_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.update_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } diff --git a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml index ed5be2c9..a7326384 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml @@ -1,8 +1,8 @@ services: - netgen_search_extra.parent_child_indexing.set_content_state_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.set_content_state: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/section.yaml b/lib/Resources/config/search/common/parent_child_indexing/section.yaml index 68afc4c3..82198aae 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/section.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/section.yaml @@ -1,8 +1,8 @@ services: - netgen_search_extra.parent_child_indexing.assign_section_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.assign_section: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml index 4ed83b69..dcf48845 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml +++ b/lib/Resources/config/search/common/parent_child_indexing/trash.yaml @@ -1,20 +1,20 @@ services: - netgen_search_extra.parent_child_indexing.recover_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.recover: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen_search_extra.parent_child_indexing.trash_handler: + netgen.ibexa_search_extra.parent_child_indexing.message_handler.trash: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.parent_child_indexer.message_handler } + - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } diff --git a/lib/Resources/config/search/solr/parent_child_indexing/field_mappers.yaml b/lib/Resources/config/search/solr/parent_child_indexing/field_mappers.yaml new file mode 100644 index 00000000..5d7486ff --- /dev/null +++ b/lib/Resources/config/search/solr/parent_child_indexing/field_mappers.yaml @@ -0,0 +1,42 @@ +services: + netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\ParentChildFieldMapper + arguments: + - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + tags: + - { name: ibexa.search.solr.field.mapper.content } + + netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper + arguments: + - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + tags: + - { name: ibexa.search.solr.field.mapper.content.translation } + + netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.location: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\ParentChildFieldMapper + arguments: + - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + tags: + - { name: ibexa.search.solr.field.mapper.location } + + netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver.native: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFullTextFieldResolver + arguments: + - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + - '@Ibexa\Core\Search\Common\FieldRegistry' + + netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver: + alias: netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver.native + + netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldMapper + arguments: + - '@netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver' + - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' + - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' + - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + tags: + - { name: netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation } diff --git a/lib/Resources/config/search/solr_services.yaml b/lib/Resources/config/search/solr_services.yaml index c551bbe1..7e6165cd 100644 --- a/lib/Resources/config/search/solr_services.yaml +++ b/lib/Resources/config/search/solr_services.yaml @@ -2,6 +2,7 @@ imports: - { resource: solr/criterion_visitors.yaml } - { resource: solr/facet_builder_visitors.yaml } - { resource: solr/field_mappers.yaml } + - { resource: solr/parent_child_indexing/field_mappers.yaml } - { resource: solr/sort_clause_visitors.yaml } - { resource: solr/subdocument_mappers.yaml } diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index b4d74f67..06db4746 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -1,5 +1,8 @@ parameters: - netgen.ibexa_search_extra.parent_child_indexer: + netgen.ibexa_search_extra.parent_child_indexing.configuration: + enabled: true + handlers: + - ng_parent_child_indexing_fulltext map: parent_child_test: children: @@ -8,14 +11,24 @@ parameters: services: netgen_search_extra.parent_child_indexing.field_mapper.fulltext: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFullTextFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldMapper arguments: - - '@netgen_search_extra.parent_child_indexing.fulltext_field_resolver' + - '@netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver.native' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '%netgen.ibexa_search_extra.parent_child_indexer%' + - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + tags: + - { name: netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation } + + netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper + arguments: + - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - + - '@netgen_search_extra.parent_child_indexing.field_mapper.fulltext' + tags: - { name: ibexa.search.solr.field.mapper.content.translation } @@ -23,7 +36,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -31,7 +44,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -40,7 +53,7 @@ services: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -48,7 +61,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -56,7 +69,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -64,7 +77,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -73,7 +86,7 @@ services: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -81,7 +94,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -89,7 +102,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -97,7 +110,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -105,7 +118,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -113,7 +126,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -121,7 +134,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -129,7 +142,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -137,7 +150,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -145,7 +158,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -153,7 +166,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -161,7 +174,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -169,7 +182,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -177,7 +190,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } From dfae66099ca596347ddd704efc5b2474c1cb0b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Mon, 10 Jun 2024 06:55:49 +0200 Subject: [PATCH 50/74] NGSTACK-836: rename parent child indexing to descendant indexing --- .../NetgenIbexaSearchExtraExtension.php | 2 +- bundle/NetgenIbexaSearchExtraBundle.php | 2 +- ...ingPass.php => DescendantIndexingPass.php} | 18 +++--- .../FullTextFieldMapper.php | 2 +- lib/Resources/config/search/common.yaml | 2 +- .../search/common/descendant_indexing.yaml | 10 +++ .../common.yaml | 12 ++-- .../content.yaml | 42 ++++++------- .../location.yaml | 54 ++++++++-------- .../object_state.yaml | 6 +- .../section.yaml | 6 +- .../trash.yaml | 12 ++-- .../search/common/parent_child_indexing.yaml | 10 --- .../field_mappers.yaml | 26 ++++---- .../config/search/solr_services.yaml | 2 +- phpunit-integration-legacy.xml | 2 +- phpunit-integration-solr.xml | 2 +- ...ingTest.php => DescendantIndexingTest.php} | 8 +-- ...vent_dispatcher_override_asynchronous.yaml | 62 +++++++++---------- 19 files changed, 140 insertions(+), 140 deletions(-) rename lib/Container/Compiler/{ParentChildIndexingPass.php => DescendantIndexingPass.php} (82%) create mode 100644 lib/Resources/config/search/common/descendant_indexing.yaml rename lib/Resources/config/search/common/{parent_child_indexing => descendant_indexing}/common.yaml (62%) rename lib/Resources/config/search/common/{parent_child_indexing => descendant_indexing}/content.yaml (54%) rename lib/Resources/config/search/common/{parent_child_indexing => descendant_indexing}/location.yaml (57%) rename lib/Resources/config/search/common/{parent_child_indexing => descendant_indexing}/object_state.yaml (50%) rename lib/Resources/config/search/common/{parent_child_indexing => descendant_indexing}/section.yaml (50%) rename lib/Resources/config/search/common/{parent_child_indexing => descendant_indexing}/trash.yaml (57%) delete mode 100644 lib/Resources/config/search/common/parent_child_indexing.yaml rename lib/Resources/config/search/solr/{parent_child_indexing => descendant_indexing}/field_mappers.yaml (54%) rename tests/lib/Integration/API/{ParentChildIndexingTest.php => DescendantIndexingTest.php} (94%) diff --git a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php index 5edc4915..acd1936f 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -162,7 +162,7 @@ private function processPageIndexingConfiguration(array $configuration, Containe private function processParentChildIndexingConfiguration(array $configuration, ContainerBuilder $container): void { $container->setParameter( - 'netgen.ibexa_search_extra.parent_child_indexing.configuration', + 'netgen.ibexa_search_extra.descendant_indexing.configuration', $configuration['hierarchical_indexing']['descendant_indexing'], ); } diff --git a/bundle/NetgenIbexaSearchExtraBundle.php b/bundle/NetgenIbexaSearchExtraBundle.php index f6c64d2a..3a1c6d41 100644 --- a/bundle/NetgenIbexaSearchExtraBundle.php +++ b/bundle/NetgenIbexaSearchExtraBundle.php @@ -22,7 +22,7 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass()); $container->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass()); $container->addCompilerPass(new Compiler\AsynchronousIndexingPass()); - $container->addCompilerPass(new Compiler\ParentChildIndexingPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 100); + $container->addCompilerPass(new Compiler\DescendantIndexingPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 100); $container->addCompilerPass(new Compiler\FieldType\RichTextIndexablePass()); $container->addCompilerPass(new Compiler\SearchResultExtractorPass()); $container->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass()); diff --git a/lib/Container/Compiler/ParentChildIndexingPass.php b/lib/Container/Compiler/DescendantIndexingPass.php similarity index 82% rename from lib/Container/Compiler/ParentChildIndexingPass.php rename to lib/Container/Compiler/DescendantIndexingPass.php index 4050be06..ab07c3a1 100644 --- a/lib/Container/Compiler/ParentChildIndexingPass.php +++ b/lib/Container/Compiler/DescendantIndexingPass.php @@ -8,17 +8,17 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; -class ParentChildIndexingPass implements CompilerPassInterface +class DescendantIndexingPass implements CompilerPassInterface { - private const ParentChildConfigurationParameter = 'netgen.ibexa_search_extra.parent_child_indexing.configuration'; - private const ParentChildMessageHandlerTag = 'netgen.ibexa_search_extra.parent_child_indexing.message_handler'; + private const ParentChildConfigurationParameter = 'netgen.ibexa_search_extra.descendant_indexing.configuration'; + private const ParentChildMessageHandlerTag = 'netgen.ibexa_search_extra.descendant_indexing.message_handler'; private const MessageHandlerTag = 'messenger.message_handler'; - private const ParentChildSolrContentFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content'; - private const ParentChildSolrContentFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content'; - private const ParentChildSolrContentTranslationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation'; - private const ParentChildSolrContentTranslationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation'; - private const ParentChildSolrLocationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.location'; - private const ParentChildSolrLocationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.location'; + private const ParentChildSolrContentFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; + private const ParentChildSolrContentFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; + private const ParentChildSolrContentTranslationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation'; + private const ParentChildSolrContentTranslationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation'; + private const ParentChildSolrLocationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location'; + private const ParentChildSolrLocationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location'; public function process(ContainerBuilder $container): void { diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php index bfcdd167..4d9c2f4d 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php @@ -79,7 +79,7 @@ public function mapFields(SPIContent $content, $languageCode): array public function getIdentifier(): string { - return 'ng_parent_child_indexing_fulltext'; + return 'ng_descendant_indexing_fulltext'; } /** diff --git a/lib/Resources/config/search/common.yaml b/lib/Resources/config/search/common.yaml index 18914fff..14ae02b5 100644 --- a/lib/Resources/config/search/common.yaml +++ b/lib/Resources/config/search/common.yaml @@ -2,7 +2,7 @@ imports: - { resource: common/asynchronous_indexing.yaml } - { resource: common/field_value_mappers.yaml } - { resource: common/page_indexing.yaml } - - { resource: common/parent_child_indexing.yaml } + - { resource: common/descendant_indexing.yaml } services: netgen.ibexa_search_extra.fulltext.configured_factory: diff --git a/lib/Resources/config/search/common/descendant_indexing.yaml b/lib/Resources/config/search/common/descendant_indexing.yaml new file mode 100644 index 00000000..ca4dc40f --- /dev/null +++ b/lib/Resources/config/search/common/descendant_indexing.yaml @@ -0,0 +1,10 @@ +imports: + - { resource: descendant_indexing/common.yaml } + - { resource: descendant_indexing/content.yaml } + - { resource: descendant_indexing/location.yaml } + - { resource: descendant_indexing/object_state.yaml } + - { resource: descendant_indexing/section.yaml } + - { resource: descendant_indexing/trash.yaml } + +parameters: + netgen.ibexa_search_extra.descendant_indexing.configuration: [] diff --git a/lib/Resources/config/search/common/parent_child_indexing/common.yaml b/lib/Resources/config/search/common/descendant_indexing/common.yaml similarity index 62% rename from lib/Resources/config/search/common/parent_child_indexing/common.yaml rename to lib/Resources/config/search/common/descendant_indexing/common.yaml index a1cd489c..8ab12554 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/common.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/common.yaml @@ -1,20 +1,20 @@ services: - netgen.ibexa_search_extra.parent_child_indexing.ancestor_path_generator: + netgen.ibexa_search_extra.descendant_indexing.ancestor_path_generator: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorPathGenerator arguments: - - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' - netgen.ibexa_search_extra.parent_child_indexing.ancestor_resolver: + netgen.ibexa_search_extra.descendant_indexing.ancestor_resolver: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorResolver arguments: - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Core\Persistence\Cache\LocationHandler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_path_generator' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_path_generator' - netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer: + netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer arguments: - '@Ibexa\Contracts\Core\Search\VersatileHandler' - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_resolver' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_resolver' diff --git a/lib/Resources/config/search/common/parent_child_indexing/content.yaml b/lib/Resources/config/search/common/descendant_indexing/content.yaml similarity index 54% rename from lib/Resources/config/search/common/parent_child_indexing/content.yaml rename to lib/Resources/config/search/common/descendant_indexing/content.yaml index 5f5330c5..6c379d82 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/content.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/content.yaml @@ -1,64 +1,64 @@ services: - netgen.ibexa_search_extra.parent_child_indexing.message_handler.copy_content: + netgen.ibexa_search_extra.descendant_indexing.message_handler.copy_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.delete_content: + netgen.ibexa_search_extra.descendant_indexing.message_handler.delete_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.delete_translation: + netgen.ibexa_search_extra.descendant_indexing.message_handler.delete_translation: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.hide_content: + netgen.ibexa_search_extra.descendant_indexing.message_handler.hide_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.publish_version: + netgen.ibexa_search_extra.descendant_indexing.message_handler.publish_version: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.reveal_content: + netgen.ibexa_search_extra.descendant_indexing.message_handler.reveal_content: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.update_content_metadata: + netgen.ibexa_search_extra.descendant_indexing.message_handler.update_content_metadata: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } diff --git a/lib/Resources/config/search/common/parent_child_indexing/location.yaml b/lib/Resources/config/search/common/descendant_indexing/location.yaml similarity index 57% rename from lib/Resources/config/search/common/parent_child_indexing/location.yaml rename to lib/Resources/config/search/common/descendant_indexing/location.yaml index 0fbac02f..a79ad0a8 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/location.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/location.yaml @@ -1,90 +1,90 @@ services: - netgen.ibexa_search_extra.parent_child_indexing.message_handler.assign_section_to_subtree: + netgen.ibexa_search_extra.descendant_indexing.message_handler.assign_section_to_subtree: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.copy_subtree: + netgen.ibexa_search_extra.descendant_indexing.message_handler.copy_subtree: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.create_location: + netgen.ibexa_search_extra.descendant_indexing.message_handler.create_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.delete_location: + netgen.ibexa_search_extra.descendant_indexing.message_handler.delete_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.hide_location: + netgen.ibexa_search_extra.descendant_indexing.message_handler.hide_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.move_subtree: + netgen.ibexa_search_extra.descendant_indexing.message_handler.move_subtree: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.swap_location: + netgen.ibexa_search_extra.descendant_indexing.message_handler.swap_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.unhide_location: + netgen.ibexa_search_extra.descendant_indexing.message_handler.unhide_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.update_location: + netgen.ibexa_search_extra.descendant_indexing.message_handler.update_location: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } diff --git a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml b/lib/Resources/config/search/common/descendant_indexing/object_state.yaml similarity index 50% rename from lib/Resources/config/search/common/parent_child_indexing/object_state.yaml rename to lib/Resources/config/search/common/descendant_indexing/object_state.yaml index a7326384..0838d3af 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/object_state.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/object_state.yaml @@ -1,8 +1,8 @@ services: - netgen.ibexa_search_extra.parent_child_indexing.message_handler.set_content_state: + netgen.ibexa_search_extra.descendant_indexing.message_handler.set_content_state: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/section.yaml b/lib/Resources/config/search/common/descendant_indexing/section.yaml similarity index 50% rename from lib/Resources/config/search/common/parent_child_indexing/section.yaml rename to lib/Resources/config/search/common/descendant_indexing/section.yaml index 82198aae..72bfbedc 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/section.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/section.yaml @@ -1,8 +1,8 @@ services: - netgen.ibexa_search_extra.parent_child_indexing.message_handler.assign_section: + netgen.ibexa_search_extra.descendant_indexing.message_handler.assign_section: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } diff --git a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml b/lib/Resources/config/search/common/descendant_indexing/trash.yaml similarity index 57% rename from lib/Resources/config/search/common/parent_child_indexing/trash.yaml rename to lib/Resources/config/search/common/descendant_indexing/trash.yaml index dcf48845..b6e0a9b2 100644 --- a/lib/Resources/config/search/common/parent_child_indexing/trash.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/trash.yaml @@ -1,20 +1,20 @@ services: - netgen.ibexa_search_extra.parent_child_indexing.message_handler.recover: + netgen.ibexa_search_extra.descendant_indexing.message_handler.recover: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } - netgen.ibexa_search_extra.parent_child_indexing.message_handler.trash: + netgen.ibexa_search_extra.descendant_indexing.message_handler.trash: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' - '@?logger' tags: - - { name: netgen.ibexa_search_extra.parent_child_indexing.message_handler } + - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } - { name: monolog.logger, channel: ngsearchextra } diff --git a/lib/Resources/config/search/common/parent_child_indexing.yaml b/lib/Resources/config/search/common/parent_child_indexing.yaml deleted file mode 100644 index ba53a4b5..00000000 --- a/lib/Resources/config/search/common/parent_child_indexing.yaml +++ /dev/null @@ -1,10 +0,0 @@ -imports: - - { resource: parent_child_indexing/common.yaml } - - { resource: parent_child_indexing/content.yaml } - - { resource: parent_child_indexing/location.yaml } - - { resource: parent_child_indexing/object_state.yaml } - - { resource: parent_child_indexing/section.yaml } - - { resource: parent_child_indexing/trash.yaml } - -parameters: - netgen.ibexa_search_extra.parent_child_indexing.configuration: [] diff --git a/lib/Resources/config/search/solr/parent_child_indexing/field_mappers.yaml b/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml similarity index 54% rename from lib/Resources/config/search/solr/parent_child_indexing/field_mappers.yaml rename to lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml index 5d7486ff..69e0d60c 100644 --- a/lib/Resources/config/search/solr/parent_child_indexing/field_mappers.yaml +++ b/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml @@ -1,42 +1,42 @@ services: - netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content: + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\ParentChildFieldMapper arguments: - - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - { name: ibexa.search.solr.field.mapper.content } - netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation: + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper arguments: - - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - { name: ibexa.search.solr.field.mapper.content.translation } - netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.location: + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\ParentChildFieldMapper arguments: - - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - { name: ibexa.search.solr.field.mapper.location } - netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver.native: + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver.native: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFullTextFieldResolver arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Core\Search\Common\FieldRegistry' - netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver: - alias: netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver.native + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver: + alias: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver.native - netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext: + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldMapper arguments: - - '@netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver' + - '@netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - - { name: netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation } + - { name: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation } diff --git a/lib/Resources/config/search/solr_services.yaml b/lib/Resources/config/search/solr_services.yaml index 7e6165cd..cf3cb90f 100644 --- a/lib/Resources/config/search/solr_services.yaml +++ b/lib/Resources/config/search/solr_services.yaml @@ -2,7 +2,7 @@ imports: - { resource: solr/criterion_visitors.yaml } - { resource: solr/facet_builder_visitors.yaml } - { resource: solr/field_mappers.yaml } - - { resource: solr/parent_child_indexing/field_mappers.yaml } + - { resource: solr/descendant_indexing/field_mappers.yaml } - { resource: solr/sort_clause_visitors.yaml } - { resource: solr/subdocument_mappers.yaml } diff --git a/phpunit-integration-legacy.xml b/phpunit-integration-legacy.xml index 142ace6f..5ae3be57 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -20,7 +20,7 @@ tests/lib/Integration/API/SubdocumentQueryCriterionTest.php tests/lib/Integration/API/FulltextSpellcheckCriterionTest.php tests/lib/Integration/API/ExtraFieldsTest.php - tests/lib/Integration/API/ParentChildIndexingTest.php + tests/lib/Integration/API/DescendantIndexingTest.php tests/lib/Integration/Solr/RawFacetDomainTest.php tests/lib/Integration/Solr/RawFacetTest.php diff --git a/phpunit-integration-solr.xml b/phpunit-integration-solr.xml index 5188da78..bbb6d8e7 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -13,7 +13,7 @@ ./tests/lib/Integration/ - tests/lib/Integration/API/ParentChildIndexingTest.php + tests/lib/Integration/API/DescendantIndexingTest.php diff --git a/tests/lib/Integration/API/ParentChildIndexingTest.php b/tests/lib/Integration/API/DescendantIndexingTest.php similarity index 94% rename from tests/lib/Integration/API/ParentChildIndexingTest.php rename to tests/lib/Integration/API/DescendantIndexingTest.php index bd150da0..5d0668d2 100644 --- a/tests/lib/Integration/API/ParentChildIndexingTest.php +++ b/tests/lib/Integration/API/DescendantIndexingTest.php @@ -10,7 +10,7 @@ /** * @group parent-child-indexing */ -final class ParentChildIndexingTest extends BaseTest +final class DescendantIndexingTest extends BaseTest { /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException @@ -31,9 +31,9 @@ public function testPublishVersion(): void $searchService = $repository->getSearchService(); $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); - $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct('parent_child_test'); + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct('descendant_indexing_test'); $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; - $contentTypeCreateStruct->names = ['eng-GB' => 'Parent child test']; + $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); $fieldDefinitionCreateStruct->position = 0; $fieldDefinitionCreateStruct->isSearchable = true; @@ -41,7 +41,7 @@ public function testPublishVersion(): void $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); $contentTypeService->publishContentTypeDraft($contentTypeDraft); - $contentType = $contentTypeService->loadContentTypeByIdentifier('parent_child_test'); + $contentType = $contentTypeService->loadContentTypeByIdentifier('descendant_indexing_test'); $locationCreateStruct = $locationService->newLocationCreateStruct(2); $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 06db4746..dd38745a 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -1,33 +1,33 @@ parameters: - netgen.ibexa_search_extra.parent_child_indexing.configuration: + netgen.ibexa_search_extra.descendant_indexing.configuration: enabled: true handlers: - - ng_parent_child_indexing_fulltext + - ng_descendant_indexing_fulltext map: - parent_child_test: + descendant_indexing_test: children: - parent_child_test: + descendant_indexing_test: indexed: true services: - netgen_search_extra.parent_child_indexing.field_mapper.fulltext: + netgen_search_extra.descendant_indexing.field_mapper.fulltext: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldMapper arguments: - - '@netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation.fulltext_field_resolver.native' + - '@netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver.native' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - - { name: netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation } + - { name: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation } - netgen.ibexa_search_extra.solr.field_mapper.parent_child_indexing.content.translation: + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper arguments: - - '%netgen.ibexa_search_extra.parent_child_indexing.configuration%' + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' - - - '@netgen_search_extra.parent_child_indexing.field_mapper.fulltext' + - '@netgen_search_extra.descendant_indexing.field_mapper.fulltext' tags: - { name: ibexa.search.solr.field.mapper.content.translation } @@ -36,7 +36,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -44,7 +44,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -53,7 +53,7 @@ services: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -61,7 +61,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -69,7 +69,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -77,7 +77,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -86,7 +86,7 @@ services: arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -94,7 +94,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -102,7 +102,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -110,7 +110,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -118,7 +118,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -126,7 +126,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -134,7 +134,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -142,7 +142,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -150,7 +150,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -158,7 +158,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -166,7 +166,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -174,7 +174,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -182,7 +182,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } @@ -190,7 +190,7 @@ services: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '@netgen.ibexa_search_extra.parent_child_indexing.ancestor_indexer' + - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } From 3b3a846ab65e7fa69e608d51b179cd98ed9453b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Mon, 10 Jun 2024 07:07:53 +0200 Subject: [PATCH 51/74] NGSTACK-836: rename parent child indexing to descendant indexing part 2 --- .../NetgenIbexaSearchExtraExtension.php | 4 +- .../Compiler/DescendantIndexingPass.php | 32 ++--- .../AncestorIndexer.php | 2 +- .../AncestorPathGenerator.php | 2 +- .../AncestorResolver.php | 2 +- .../Content/CopyContentHandler.php | 4 +- .../Content/DeleteContentHandler.php | 4 +- .../Content/DeleteTranslationHandler.php | 4 +- .../Content/HideContentHandler.php | 4 +- .../Content/PublishVersionHandler.php | 4 +- .../Content/RevealContentHandler.php | 4 +- .../Content/UpdateContentMetadataHandler.php | 4 +- .../AssignSectionToSubtreeHandler.php | 4 +- .../Location/CopySubtreeHandler.php | 4 +- .../Location/CreateLocationHandler.php | 4 +- .../Location/DeleteLocationHandler.php | 4 +- .../Location/HideLocationHandler.php | 4 +- .../Location/MoveSubtreeHandler.php | 4 +- .../Location/SwapLocationHandler.php | 4 +- .../Location/UnhideLocationHandler.php | 4 +- .../Location/UpdateLocationHandler.php | 4 +- .../ObjectState/SetContentStateHandler.php | 4 +- .../Section/AssignSectionHandler.php | 4 +- .../Trash/RecoverHandler.php | 4 +- .../Trash/TrashHandler.php | 4 +- ...ldMapper.php => DescendantFieldMapper.php} | 6 +- .../BaseFieldMapper.php | 2 +- ...ldMapper.php => DescendantFieldMapper.php} | 6 +- .../BaseFieldMapper.php | 2 +- .../FullTextFieldMapper.php | 4 +- .../FullTextFieldResolver.php | 2 +- .../NativeFullTextFieldResolver.php | 4 +- ...ldMapper.php => DescendantFieldMapper.php} | 6 +- .../BaseFieldMapper.php | 2 +- .../common/descendant_indexing/common.yaml | 6 +- .../common/descendant_indexing/content.yaml | 14 +- .../common/descendant_indexing/location.yaml | 18 +-- .../descendant_indexing/object_state.yaml | 2 +- .../common/descendant_indexing/section.yaml | 2 +- .../common/descendant_indexing/trash.yaml | 4 +- .../descendant_indexing/field_mappers.yaml | 10 +- ...vent_dispatcher_override_asynchronous.yaml | 124 +++++++++--------- .../AncestorPathGeneratorTest.php | 2 +- .../AncestorResolverTest.php | 4 +- 44 files changed, 171 insertions(+), 171 deletions(-) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/AncestorIndexer.php (98%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/AncestorPathGenerator.php (98%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/AncestorResolver.php (99%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Content/CopyContentHandler.php (88%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Content/DeleteContentHandler.php (94%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Content/DeleteTranslationHandler.php (94%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Content/HideContentHandler.php (88%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Content/PublishVersionHandler.php (88%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Content/RevealContentHandler.php (88%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Content/UpdateContentMetadataHandler.php (95%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/AssignSectionToSubtreeHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/CopySubtreeHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/CreateLocationHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/DeleteLocationHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/HideLocationHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/MoveSubtreeHandler.php (94%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/SwapLocationHandler.php (93%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/UnhideLocationHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Location/UpdateLocationHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/ObjectState/SetContentStateHandler.php (88%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Section/AssignSectionHandler.php (88%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Trash/RecoverHandler.php (92%) rename lib/Core/Search/Common/Messenger/MessageHandler/Search/{ParentChildIndexing => DescendantIndexing}/Trash/TrashHandler.php (93%) rename lib/Core/Search/Solr/FieldMapper/Content/{ParentChildFieldMapper.php => DescendantFieldMapper.php} (88%) rename lib/Core/Search/Solr/FieldMapper/Content/{ParentChildFieldMapper => DescendantFieldMapper}/BaseFieldMapper.php (97%) rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/{ParentChildFieldMapper.php => DescendantFieldMapper.php} (87%) rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/{ParentChildFieldMapper => DescendantFieldMapper}/BaseFieldMapper.php (97%) rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/{ParentChildFieldMapper => DescendantFieldMapper}/FullTextFieldMapper.php (98%) rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/{ParentChildFieldMapper => DescendantFieldMapper}/FullTextFieldResolver.php (89%) rename lib/Core/Search/Solr/FieldMapper/ContentTranslation/{ParentChildFieldMapper => DescendantFieldMapper}/FullTextFieldResolver/NativeFullTextFieldResolver.php (95%) rename lib/Core/Search/Solr/FieldMapper/Location/{ParentChildFieldMapper.php => DescendantFieldMapper.php} (88%) rename lib/Core/Search/Solr/FieldMapper/Location/{ParentChildFieldMapper => DescendantFieldMapper}/BaseFieldMapper.php (98%) diff --git a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php index acd1936f..97ce17bd 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -94,7 +94,7 @@ private function processExtensionConfiguration(array $configs, ContainerBuilder $this->processFullTextBoostConfiguration($configuration, $container); $this->processUsePageIndexingConfiguration($configuration, $container); $this->processPageIndexingConfiguration($configuration, $container); - $this->processParentChildIndexingConfiguration($configuration, $container); + $this->processDescendantIndexingConfiguration($configuration, $container); } private function processSearchResultExtractorConfiguration(array $configuration, ContainerBuilder $container): void @@ -159,7 +159,7 @@ private function processPageIndexingConfiguration(array $configuration, Containe ); } - private function processParentChildIndexingConfiguration(array $configuration, ContainerBuilder $container): void + private function processDescendantIndexingConfiguration(array $configuration, ContainerBuilder $container): void { $container->setParameter( 'netgen.ibexa_search_extra.descendant_indexing.configuration', diff --git a/lib/Container/Compiler/DescendantIndexingPass.php b/lib/Container/Compiler/DescendantIndexingPass.php index ab07c3a1..d8c23d55 100644 --- a/lib/Container/Compiler/DescendantIndexingPass.php +++ b/lib/Container/Compiler/DescendantIndexingPass.php @@ -10,19 +10,19 @@ class DescendantIndexingPass implements CompilerPassInterface { - private const ParentChildConfigurationParameter = 'netgen.ibexa_search_extra.descendant_indexing.configuration'; - private const ParentChildMessageHandlerTag = 'netgen.ibexa_search_extra.descendant_indexing.message_handler'; + private const DescendantIndexingConfigurationParameter = 'netgen.ibexa_search_extra.descendant_indexing.configuration'; + private const DescendantIndexingMessageHandlerTag = 'netgen.ibexa_search_extra.descendant_indexing.message_handler'; private const MessageHandlerTag = 'messenger.message_handler'; - private const ParentChildSolrContentFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; - private const ParentChildSolrContentFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; - private const ParentChildSolrContentTranslationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation'; - private const ParentChildSolrContentTranslationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation'; - private const ParentChildSolrLocationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location'; - private const ParentChildSolrLocationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location'; + private const DescendantIndexingSolrContentFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; + private const DescendantIndexingSolrContentFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; + private const DescendantIndexingSolrContentTranslationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation'; + private const DescendantIndexingSolrContentTranslationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation'; + private const DescendantIndexingSolrLocationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location'; + private const DescendantIndexingSolrLocationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location'; public function process(ContainerBuilder $container): void { - $configuration = $container->getParameter(self::ParentChildConfigurationParameter); + $configuration = $container->getParameter(self::DescendantIndexingConfigurationParameter); $isEnabled = $configuration['enabled'] ?? false; if (!$isEnabled) { @@ -37,7 +37,7 @@ public function process(ContainerBuilder $container): void private function registerHandlers(ContainerBuilder $container): void { - $serviceIds = $container->findTaggedServiceIds(self::ParentChildMessageHandlerTag); + $serviceIds = $container->findTaggedServiceIds(self::DescendantIndexingMessageHandlerTag); foreach ($serviceIds as $serviceId => $tag) { $definition = $container->getDefinition($serviceId); @@ -47,8 +47,8 @@ private function registerHandlers(ContainerBuilder $container): void private function registerSolrContentFieldMappers(ContainerBuilder $container): void { - $definition = $container->getDefinition(self::ParentChildSolrContentFieldMapperServiceId); - $serviceIds = $container->findTaggedServiceIds(self::ParentChildSolrContentFieldMapperTag); + $definition = $container->getDefinition(self::DescendantIndexingSolrContentFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::DescendantIndexingSolrContentFieldMapperTag); foreach (array_keys($serviceIds) as $id) { $definition->addMethodCall('addFieldMapper', [new Reference($id)]); @@ -57,8 +57,8 @@ private function registerSolrContentFieldMappers(ContainerBuilder $container): v private function registerSolrContentTranslationFieldMappers(ContainerBuilder $container): void { - $definition = $container->getDefinition(self::ParentChildSolrContentTranslationFieldMapperServiceId); - $serviceIds = $container->findTaggedServiceIds(self::ParentChildSolrContentTranslationFieldMapperTag); + $definition = $container->getDefinition(self::DescendantIndexingSolrContentTranslationFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::DescendantIndexingSolrContentTranslationFieldMapperTag); foreach (array_keys($serviceIds) as $id) { $definition->addMethodCall('addFieldMapper', [new Reference($id)]); @@ -67,8 +67,8 @@ private function registerSolrContentTranslationFieldMappers(ContainerBuilder $co private function registerSolrLocationFieldMappers(ContainerBuilder $container): void { - $definition = $container->getDefinition(self::ParentChildSolrLocationFieldMapperServiceId); - $serviceIds = $container->findTaggedServiceIds(self::ParentChildSolrLocationFieldMapperTag); + $definition = $container->getDefinition(self::DescendantIndexingSolrLocationFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::DescendantIndexingSolrLocationFieldMapperTag); foreach (array_keys($serviceIds) as $id) { $definition->addMethodCall('addFieldMapper', [new Reference($id)]); diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorIndexer.php similarity index 98% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorIndexer.php index 51285913..e43a2e90 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorIndexer.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorIndexer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorPathGenerator.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorPathGenerator.php similarity index 98% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorPathGenerator.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorPathGenerator.php index e9597669..3d8f2b99 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorPathGenerator.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorPathGenerator.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing; use function array_merge; use function array_shift; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php similarity index 99% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php index 94901d04..42baf418 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/AncestorResolver.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/CopyContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/CopyContentHandler.php similarity index 88% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/CopyContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/CopyContentHandler.php index 6be41995..be51305e 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/CopyContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/CopyContentHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\CopyContent; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/DeleteContentHandler.php similarity index 94% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/DeleteContentHandler.php index f85f27d9..0eb968a9 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/DeleteContentHandler.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/DeleteTranslationHandler.php similarity index 94% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/DeleteTranslationHandler.php index ab20de5d..49fcfd91 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/DeleteTranslationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/DeleteTranslationHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/HideContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/HideContentHandler.php similarity index 88% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/HideContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/HideContentHandler.php index 8b0233c4..7547fb57 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/HideContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/HideContentHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\HideContent; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/PublishVersionHandler.php similarity index 88% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/PublishVersionHandler.php index d248be27..cdbe3b19 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/PublishVersionHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/PublishVersionHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\PublishVersion; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/RevealContentHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/RevealContentHandler.php similarity index 88% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/RevealContentHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/RevealContentHandler.php index 5c936f52..8bbf039e 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/RevealContentHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/RevealContentHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\RevealContent; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/UpdateContentMetadataHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/UpdateContentMetadataHandler.php similarity index 95% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/UpdateContentMetadataHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/UpdateContentMetadataHandler.php index c854297c..9594501b 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Content/UpdateContentMetadataHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Content/UpdateContentMetadataHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/AssignSectionToSubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/AssignSectionToSubtreeHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/AssignSectionToSubtreeHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/AssignSectionToSubtreeHandler.php index e9913bf2..ea3555ca 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/AssignSectionToSubtreeHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/AssignSectionToSubtreeHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\AssignSectionToSubtree; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CopySubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/CopySubtreeHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CopySubtreeHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/CopySubtreeHandler.php index fd4694ac..248ac6d1 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CopySubtreeHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/CopySubtreeHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CopySubtree; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CreateLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/CreateLocationHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CreateLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/CreateLocationHandler.php index 00e4f3f3..9da02cd7 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/CreateLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/CreateLocationHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CreateLocation; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/DeleteLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/DeleteLocationHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/DeleteLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/DeleteLocationHandler.php index 300fd175..d4acbcb1 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/DeleteLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/DeleteLocationHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\DeleteLocation; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/HideLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/HideLocationHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/HideLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/HideLocationHandler.php index e4f08810..6667ab9c 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/HideLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/HideLocationHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\HideLocation; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/MoveSubtreeHandler.php similarity index 94% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/MoveSubtreeHandler.php index 516a403f..25bb35b5 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/MoveSubtreeHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/MoveSubtreeHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\MoveSubtree; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/SwapLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/SwapLocationHandler.php similarity index 93% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/SwapLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/SwapLocationHandler.php index ae039193..db06ec37 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/SwapLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/SwapLocationHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\SwapLocation; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UnhideLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/UnhideLocationHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UnhideLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/UnhideLocationHandler.php index 69dc00c9..06df3be7 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UnhideLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/UnhideLocationHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UnhideLocation; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UpdateLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/UpdateLocationHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UpdateLocationHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/UpdateLocationHandler.php index 92a76f98..0f19d78e 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Location/UpdateLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/UpdateLocationHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UpdateLocation; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/ObjectState/SetContentStateHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/ObjectState/SetContentStateHandler.php similarity index 88% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/ObjectState/SetContentStateHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/ObjectState/SetContentStateHandler.php index bee8711b..bda806ba 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/ObjectState/SetContentStateHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/ObjectState/SetContentStateHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\ObjectState; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\ObjectState\SetContentState; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Section/AssignSectionHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Section/AssignSectionHandler.php similarity index 88% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Section/AssignSectionHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Section/AssignSectionHandler.php index df1ad48b..30adea80 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Section/AssignSectionHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Section/AssignSectionHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Section; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Section\AssignSection; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/RecoverHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Trash/RecoverHandler.php similarity index 92% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/RecoverHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Trash/RecoverHandler.php index 93f49e73..daf94c13 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/RecoverHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Trash/RecoverHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Recover; diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Trash/TrashHandler.php similarity index 93% rename from lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php rename to lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Trash/TrashHandler.php index 48336671..5a994bf6 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/ParentChildIndexing/Trash/TrashHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Trash/TrashHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash; +namespace Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash; use Ibexa\Contracts\Core\Persistence\Content\Location; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Trash; diff --git a/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper.php similarity index 88% rename from lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper.php index f3af98cf..51cd53eb 100644 --- a/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper.php @@ -6,14 +6,14 @@ use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Solr\FieldMapper\ContentFieldMapper; -use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\ParentChildFieldMapper\BaseFieldMapper; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper\BaseFieldMapper; use function array_merge; -final class ParentChildFieldMapper extends ContentFieldMapper +final class DescendantFieldMapper extends ContentFieldMapper { /** - * @param \Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\ParentChildFieldMapper\BaseFieldMapper[] $fieldMappers + * @param \Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper\BaseFieldMapper[] $fieldMappers */ public function __construct( private readonly array $configuration, diff --git a/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php similarity index 97% rename from lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper/BaseFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php index dcdd5025..8b5712d4 100644 --- a/lib/Core/Search/Solr/FieldMapper/Content/ParentChildFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php @@ -3,7 +3,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\ParentChildFieldMapper; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper.php similarity index 87% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper.php index c5b36f0f..aec82d0b 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper.php @@ -6,14 +6,14 @@ use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Solr\FieldMapper\ContentTranslationFieldMapper; -use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\BaseFieldMapper; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\BaseFieldMapper; use function array_merge; -final class ParentChildFieldMapper extends ContentTranslationFieldMapper +final class DescendantFieldMapper extends ContentTranslationFieldMapper { /** - * @param \Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\BaseFieldMapper[] $fieldMappers + * @param \Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\BaseFieldMapper[] $fieldMappers */ public function __construct( private readonly array $configuration, diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php similarity index 97% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/BaseFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php index 4a7ff4e2..a89c5c8f 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php @@ -3,7 +3,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldMapper.php similarity index 98% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldMapper.php index 4d9c2f4d..e8829d46 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldMapper.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; @@ -18,7 +18,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; use Ibexa\Contracts\Solr\FieldMapper\ContentTranslationFieldMapper; -use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldResolver; use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\IdentifiableFieldMapper; use function array_key_exists; diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldResolver.php similarity index 89% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldResolver.php index 8a81e3ef..46d82bea 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldResolver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php similarity index 95% rename from lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php rename to lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php index 1cc8dc85..5633b664 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ParentChildFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldResolver/NativeFullTextFieldResolver.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldResolver; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; @@ -11,7 +11,7 @@ use Ibexa\Contracts\Core\Search\FieldType\FullTextField; use Ibexa\Contracts\Core\Search\FieldType\TextField; use Ibexa\Core\Search\Common\FieldRegistry; -use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldResolver; final class NativeFullTextFieldResolver implements FullTextFieldResolver { diff --git a/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper.php similarity index 88% rename from lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper.php index cab690fe..590d3dbf 100644 --- a/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper.php @@ -6,14 +6,14 @@ use Ibexa\Contracts\Core\Persistence\Content\Location; use Ibexa\Contracts\Solr\FieldMapper\LocationFieldMapper; -use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\ParentChildFieldMapper\BaseFieldMapper; +use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\DescendantFieldMapper\BaseFieldMapper; use function array_merge; -final class ParentChildFieldMapper extends LocationFieldMapper +final class DescendantFieldMapper extends LocationFieldMapper { /** - * @param \Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\ParentChildFieldMapper\BaseFieldMapper[] $fieldMappers + * @param \Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\DescendantFieldMapper\BaseFieldMapper[] $fieldMappers */ public function __construct( private readonly array $configuration, diff --git a/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php similarity index 98% rename from lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper/BaseFieldMapper.php rename to lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php index 5e5c4e1d..09847718 100644 --- a/lib/Core/Search/Solr/FieldMapper/Location/ParentChildFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php @@ -3,7 +3,7 @@ declare(strict_types=1); -namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\ParentChildFieldMapper; +namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content\Location; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; diff --git a/lib/Resources/config/search/common/descendant_indexing/common.yaml b/lib/Resources/config/search/common/descendant_indexing/common.yaml index 8ab12554..7fdb828f 100644 --- a/lib/Resources/config/search/common/descendant_indexing/common.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/common.yaml @@ -1,11 +1,11 @@ services: netgen.ibexa_search_extra.descendant_indexing.ancestor_path_generator: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorPathGenerator + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorPathGenerator arguments: - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' netgen.ibexa_search_extra.descendant_indexing.ancestor_resolver: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorResolver + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorResolver arguments: - '@Ibexa\Core\Persistence\Legacy\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' @@ -13,7 +13,7 @@ services: - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_path_generator' netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorIndexer + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorIndexer arguments: - '@Ibexa\Contracts\Core\Search\VersatileHandler' - '@Ibexa\Core\Persistence\Legacy\Content\Handler' diff --git a/lib/Resources/config/search/common/descendant_indexing/content.yaml b/lib/Resources/config/search/common/descendant_indexing/content.yaml index 6c379d82..50f1eb57 100644 --- a/lib/Resources/config/search/common/descendant_indexing/content.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/content.yaml @@ -1,6 +1,6 @@ services: netgen.ibexa_search_extra.descendant_indexing.message_handler.copy_content: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\CopyContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -8,7 +8,7 @@ services: - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } netgen.ibexa_search_extra.descendant_indexing.message_handler.delete_content: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -18,7 +18,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.delete_translation: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteTranslationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -29,7 +29,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.hide_content: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\HideContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -37,7 +37,7 @@ services: - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } netgen.ibexa_search_extra.descendant_indexing.message_handler.publish_version: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\PublishVersionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -45,7 +45,7 @@ services: - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } netgen.ibexa_search_extra.descendant_indexing.message_handler.reveal_content: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\RevealContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -53,7 +53,7 @@ services: - { name: netgen.ibexa_search_extra.descendant_indexing.message_handler } netgen.ibexa_search_extra.descendant_indexing.message_handler.update_content_metadata: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\UpdateContentMetadataHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' diff --git a/lib/Resources/config/search/common/descendant_indexing/location.yaml b/lib/Resources/config/search/common/descendant_indexing/location.yaml index a79ad0a8..dab92d9d 100644 --- a/lib/Resources/config/search/common/descendant_indexing/location.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/location.yaml @@ -1,6 +1,6 @@ services: netgen.ibexa_search_extra.descendant_indexing.message_handler.assign_section_to_subtree: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\AssignSectionToSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -10,7 +10,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.copy_subtree: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CopySubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -20,7 +20,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.create_location: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CreateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -30,7 +30,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.delete_location: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\DeleteLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -40,7 +40,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.hide_location: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\HideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -50,7 +50,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.move_subtree: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\MoveSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -60,7 +60,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.swap_location: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\SwapLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -70,7 +70,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.unhide_location: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UnhideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -80,7 +80,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.update_location: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UpdateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' diff --git a/lib/Resources/config/search/common/descendant_indexing/object_state.yaml b/lib/Resources/config/search/common/descendant_indexing/object_state.yaml index 0838d3af..bf196e77 100644 --- a/lib/Resources/config/search/common/descendant_indexing/object_state.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/object_state.yaml @@ -1,6 +1,6 @@ services: netgen.ibexa_search_extra.descendant_indexing.message_handler.set_content_state: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\ObjectState\SetContentStateHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' diff --git a/lib/Resources/config/search/common/descendant_indexing/section.yaml b/lib/Resources/config/search/common/descendant_indexing/section.yaml index 72bfbedc..64c05099 100644 --- a/lib/Resources/config/search/common/descendant_indexing/section.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/section.yaml @@ -1,6 +1,6 @@ services: netgen.ibexa_search_extra.descendant_indexing.message_handler.assign_section: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Section\AssignSectionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' diff --git a/lib/Resources/config/search/common/descendant_indexing/trash.yaml b/lib/Resources/config/search/common/descendant_indexing/trash.yaml index b6e0a9b2..2a4fdbf2 100644 --- a/lib/Resources/config/search/common/descendant_indexing/trash.yaml +++ b/lib/Resources/config/search/common/descendant_indexing/trash.yaml @@ -1,6 +1,6 @@ services: netgen.ibexa_search_extra.descendant_indexing.message_handler.recover: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\RecoverHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -10,7 +10,7 @@ services: - { name: monolog.logger, channel: ngsearchextra } netgen.ibexa_search_extra.descendant_indexing.message_handler.trash: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\TrashHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' diff --git a/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml b/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml index 69e0d60c..a1b7a4f4 100644 --- a/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml +++ b/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml @@ -1,27 +1,27 @@ services: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\ParentChildFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper arguments: - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - { name: ibexa.search.solr.field.mapper.content } netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper arguments: - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - { name: ibexa.search.solr.field.mapper.content.translation } netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\ParentChildFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\DescendantFieldMapper arguments: - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' tags: - { name: ibexa.search.solr.field.mapper.location } netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver.native: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldResolver\NativeFullTextFieldResolver + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldResolver\NativeFullTextFieldResolver arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - '@Ibexa\Core\Search\Common\FieldRegistry' @@ -30,7 +30,7 @@ services: alias: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver.native netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldMapper arguments: - '@netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index dd38745a..554bee97 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -11,7 +11,7 @@ parameters: services: netgen_search_extra.descendant_indexing.field_mapper.fulltext: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper\FullTextFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldMapper arguments: - '@netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver.native' - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' @@ -23,7 +23,7 @@ services: - { name: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation } netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\ParentChildFieldMapper + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper arguments: - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' - @@ -32,24 +32,24 @@ services: tags: - { name: ibexa.search.solr.field.mapper.content.translation } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\CopyContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\CopyContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteTranslationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteTranslationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -57,32 +57,32 @@ services: tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\HideContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\HideContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\PublishVersionHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\PublishVersionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\RevealContentHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\RevealContentHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\UpdateContentMetadataHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\UpdateContentMetadataHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' @@ -90,104 +90,104 @@ services: tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\AssignSectionToSubtreeHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\AssignSectionToSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CopySubtreeHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CopySubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CreateLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CreateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\DeleteLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\DeleteLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\HideLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\HideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\MoveSubtreeHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\MoveSubtreeHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\SwapLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\SwapLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UnhideLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UnhideLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UpdateLocationHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UpdateLocationHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\ObjectState\SetContentStateHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\ObjectState\SetContentStateHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Section\AssignSectionHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Section\AssignSectionHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\RecoverHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\RecoverHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' tags: - { name: messenger.message_handler } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler: - class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler + Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\TrashHandler: + class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\TrashHandler arguments: - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - '@netgen.ibexa_search_extra.descendant_indexing.ancestor_indexer' @@ -200,64 +200,64 @@ services: - 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\CopyContent': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\CopyContentHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\CopyContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\CopyContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteContent': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\DeleteContentHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\DeleteTranslation': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\DeleteTranslationHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\DeleteTranslationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\DeleteTranslationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\HideContent': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\HideContentHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\HideContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\HideContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\PublishVersion': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\PublishVersionHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\PublishVersionHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\PublishVersionHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\RevealContent': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\RevealContentHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\RevealContentHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\RevealContentHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Content\UpdateContentMetadata': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Content\UpdateContentMetadataHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Content\UpdateContentMetadataHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\UpdateContentMetadataHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\AssignSectionToSubtree': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\AssignSectionToSubtreeHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\AssignSectionToSubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\AssignSectionToSubtreeHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CopySubtree': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\CopySubtreeHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CopySubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CopySubtreeHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\CreateLocation': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\CreateLocationHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\CreateLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\CreateLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\DeleteLocation': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\DeleteLocationHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\DeleteLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\DeleteLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\HideLocation': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\HideLocationHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\HideLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\HideLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\MoveSubtree': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\MoveSubtreeHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\MoveSubtreeHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\MoveSubtreeHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\SwapLocation': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\SwapLocationHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\SwapLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\SwapLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UnhideLocation': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\UnhideLocationHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UnhideLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UnhideLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Location\UpdateLocation': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Location\UpdateLocationHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Location\UpdateLocationHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Location\UpdateLocationHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\ObjectState\SetContentState': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\ObjectState\SetContentStateHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\ObjectState\SetContentStateHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\ObjectState\SetContentStateHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Section\AssignSection': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Section\AssignSectionHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Section\AssignSectionHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Section\AssignSectionHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Recover': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash\RecoverHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\RecoverHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\RecoverHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\Trash\Trash': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\Trash\TrashHandler' - - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\Trash\TrashHandler' + - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Trash\TrashHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\AssignUserToUserGroup': - '@Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\AsynchronousIndexing\User\AssignUserToUserGroupHandler' 'Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\Message\Search\User\BeforeUnAssignUserFromUserGroup': diff --git a/tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php index ea002f74..bd662474 100644 --- a/tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php +++ b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorPathGeneratorTest.php @@ -4,7 +4,7 @@ namespace Netgen\IbexaSearchExtra\Tests\Unit\Core\HierarchicalIndexing; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorPathGenerator; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorPathGenerator; use PHPUnit\Framework\TestCase; /** diff --git a/tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php index 8fc67ed2..a51b37d5 100644 --- a/tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php +++ b/tests/lib/Unit/Core/HierarchicalIndexing/AncestorResolverTest.php @@ -11,8 +11,8 @@ use Ibexa\Contracts\Core\Persistence\Content\Type; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandlerInterface; use Ibexa\Core\Base\Exceptions\NotFoundException; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorPathGenerator; -use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\ParentChildIndexing\AncestorResolver; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorPathGenerator; +use Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\AncestorResolver; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use RuntimeException; From 0079e133891f4348e297fa24538d9cb402e63ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 11 Jun 2024 07:35:47 +0200 Subject: [PATCH 52/74] NGSTACK-836: add Block and BlockTranslation Descendant FieldMappers --- .../Compiler/DescendantIndexingPass.php | 24 +++++++++ .../Block/DescendantFieldMapper.php | 52 +++++++++++++++++++ .../DescendantFieldMapper/BaseFieldMapper.php | 43 +++++++++++++++ .../DescendantFieldMapper.php | 52 +++++++++++++++++++ .../DescendantFieldMapper/BaseFieldMapper.php | 43 +++++++++++++++ .../descendant_indexing/field_mappers.yaml | 14 +++++ 6 files changed, 228 insertions(+) create mode 100644 lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper.php create mode 100644 lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php create mode 100644 lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper.php create mode 100644 lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php diff --git a/lib/Container/Compiler/DescendantIndexingPass.php b/lib/Container/Compiler/DescendantIndexingPass.php index d8c23d55..2bb1939b 100644 --- a/lib/Container/Compiler/DescendantIndexingPass.php +++ b/lib/Container/Compiler/DescendantIndexingPass.php @@ -13,6 +13,10 @@ class DescendantIndexingPass implements CompilerPassInterface private const DescendantIndexingConfigurationParameter = 'netgen.ibexa_search_extra.descendant_indexing.configuration'; private const DescendantIndexingMessageHandlerTag = 'netgen.ibexa_search_extra.descendant_indexing.message_handler'; private const MessageHandlerTag = 'messenger.message_handler'; + private const DescendantIndexingSolrBlockFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.block'; + private const DescendantIndexingSolrBlockFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.block'; + private const DescendantIndexingSolrBlockTranslationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.block.translation'; + private const DescendantIndexingSolrBlockTranslationFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.block.translation'; private const DescendantIndexingSolrContentFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; private const DescendantIndexingSolrContentFieldMapperTag = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content'; private const DescendantIndexingSolrContentTranslationFieldMapperServiceId = 'netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation'; @@ -45,6 +49,26 @@ private function registerHandlers(ContainerBuilder $container): void } } + private function registerSolrBlockFieldMappers(ContainerBuilder $container): void + { + $definition = $container->getDefinition(self::DescendantIndexingSolrBlockFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::DescendantIndexingSolrBlockFieldMapperTag); + + foreach (array_keys($serviceIds) as $id) { + $definition->addMethodCall('addFieldMapper', [new Reference($id)]); + } + } + + private function registerSolrBlockTranslationFieldMappers(ContainerBuilder $container): void + { + $definition = $container->getDefinition(self::DescendantIndexingSolrBlockTranslationFieldMapperServiceId); + $serviceIds = $container->findTaggedServiceIds(self::DescendantIndexingSolrBlockTranslationFieldMapperTag); + + foreach (array_keys($serviceIds) as $id) { + $definition->addMethodCall('addFieldMapper', [new Reference($id)]); + } + } + private function registerSolrContentFieldMappers(ContainerBuilder $container): void { $definition = $container->getDefinition(self::DescendantIndexingSolrContentFieldMapperServiceId); diff --git a/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper.php new file mode 100644 index 00000000..7c169f53 --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper.php @@ -0,0 +1,52 @@ +fieldMappers as $fieldMapper) { + $this->addFieldMapper($fieldMapper); + } + } + + public function addFieldMapper(BaseFieldMapper $fieldMapper): void + { + $this->fieldMappers[] = $fieldMapper; + } + + public function accept(Content $content): bool + { + return $this->configuration['enabled'] ?? false; + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + public function mapFields(Content $content): array + { + $fieldsGrouped = [[]]; + + foreach ($this->fieldMappers as $fieldMapper) { + if ($fieldMapper->accept($content)) { + $fieldsGrouped[] = $fieldMapper->mapFields($content); + } + } + + return array_merge(...$fieldsGrouped); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php new file mode 100644 index 00000000..b25b6dba --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php @@ -0,0 +1,43 @@ +internalAccept($content) && $this->doAccept($content); + } + + abstract public function doAccept(Content $content): bool; + + abstract public function getIdentifier(): string; + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + private function internalAccept(Content $content): bool + { + $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); + + $map = $this->configuration['map'] ?? []; + $handlers = $this->configuration['handlers'] ?? []; + + return array_key_exists($contentType->identifier, $map) + && in_array($this->getIdentifier(), $handlers, true); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper.php new file mode 100644 index 00000000..645d6805 --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper.php @@ -0,0 +1,52 @@ +fieldMappers as $fieldMapper) { + $this->addFieldMapper($fieldMapper); + } + } + + public function addFieldMapper(BaseFieldMapper $fieldMapper): void + { + $this->fieldMappers[] = $fieldMapper; + } + + public function accept(Content $content, $languageCode): bool + { + return $this->configuration['enabled'] ?? false; + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + public function mapFields(Content $content, $languageCode): array + { + $fieldsGrouped = [[]]; + + foreach ($this->fieldMappers as $fieldMapper) { + if ($fieldMapper->accept($content, $languageCode)) { + $fieldsGrouped[] = $fieldMapper->mapFields($content, $languageCode); + } + } + + return array_merge(...$fieldsGrouped); + } +} diff --git a/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php new file mode 100644 index 00000000..84f87e0c --- /dev/null +++ b/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php @@ -0,0 +1,43 @@ +internalAccept($content) && $this->doAccept($content, $languageCode); + } + + abstract public function doAccept(Content $content, string $languageCode): bool; + + abstract public function getIdentifier(): string; + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + private function internalAccept(Content $content): bool + { + $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); + + $map = $this->configuration['map'] ?? []; + $handlers = $this->configuration['handlers'] ?? []; + + return array_key_exists($contentType->identifier, $map) + && in_array($this->getIdentifier(), $handlers, true); + } +} diff --git a/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml b/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml index a1b7a4f4..4c14a845 100644 --- a/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml +++ b/lib/Resources/config/search/solr/descendant_indexing/field_mappers.yaml @@ -1,4 +1,18 @@ services: + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.block: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Block\DescendantFieldMapper + arguments: + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' + tags: + - { name: ibexa.search.solr.field.mapper.block } + + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.block.translation: + class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\BlockTranslation\DescendantFieldMapper + arguments: + - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' + tags: + - { name: ibexa.search.solr.field.mapper.block.translation } + netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content: class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper arguments: From 19b27925eaa93c640d0deffa28f7fe6db147823f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 11 Jun 2024 07:36:19 +0200 Subject: [PATCH 53/74] NGSTACK-836: rename cleanup --- tests/lib/Integration/API/DescendantIndexingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Integration/API/DescendantIndexingTest.php b/tests/lib/Integration/API/DescendantIndexingTest.php index 5d0668d2..38709d4c 100644 --- a/tests/lib/Integration/API/DescendantIndexingTest.php +++ b/tests/lib/Integration/API/DescendantIndexingTest.php @@ -8,7 +8,7 @@ use Ibexa\Tests\Integration\Core\Repository\BaseTest; /** - * @group parent-child-indexing + * @group descendant-indexing */ final class DescendantIndexingTest extends BaseTest { From 8b56564a232c4c1becf89dcd82efe0524e9b4d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 11 Jun 2024 07:36:35 +0200 Subject: [PATCH 54/74] NGSTACK-836: fix CS --- .../Search/DescendantIndexing/AncestorResolver.php | 2 +- .../Content/DescendantFieldMapper/BaseFieldMapper.php | 1 - .../DescendantFieldMapper/BaseFieldMapper.php | 1 - .../Location/DescendantFieldMapper/BaseFieldMapper.php | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php index 42baf418..8e73657e 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php @@ -46,7 +46,7 @@ public function resolveAncestor(Location $location): ?Location } /** - * Return the location if its content type matches the path parent. + * Return the Location if its content type matches the path parent. */ public function resolveAncestorForParentLocation(Location $location): ?Location { diff --git a/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php index 8b5712d4..b48b0b82 100644 --- a/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php @@ -2,7 +2,6 @@ declare(strict_types=1); - namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content; diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php index a89c5c8f..c578a487 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php @@ -2,7 +2,6 @@ declare(strict_types=1); - namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content; diff --git a/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php index 09847718..b85932aa 100644 --- a/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php @@ -2,7 +2,6 @@ declare(strict_types=1); - namespace Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\DescendantFieldMapper; use Ibexa\Contracts\Core\Persistence\Content\Location; From 0283d686955090c92e9a0c3d2e5bc4276adea775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 11 Jul 2024 15:10:53 +0200 Subject: [PATCH 55/74] NGSTACK-836 tests for descendant indexing --- .../API/DescendantIndexingContentTest.php | 288 +++++++++++ .../API/DescendantIndexingLocationTest.php | 471 ++++++++++++++++++ .../API/DescendantIndexingObjectStateTest.php | 114 +++++ .../API/DescendantIndexingSectionTest.php | 134 +++++ .../API/DescendantIndexingTest.php | 77 --- .../API/DescendantIndexingTrashTest.php | 158 ++++++ .../LocationPriorityFieldMapper.php | 151 ++++++ .../FieldMapper/ObjectStateFieldMapper.php | 160 ++++++ .../Solr/FieldMapper/SectionFieldMapper.php | 143 ++++++ ...vent_dispatcher_override_asynchronous.yaml | 30 +- .../Resources/config/services.yaml | 38 ++ .../SetupFactory/SolrAsynchronous.php | 2 + 12 files changed, 1666 insertions(+), 100 deletions(-) create mode 100644 tests/lib/Integration/API/DescendantIndexingContentTest.php create mode 100644 tests/lib/Integration/API/DescendantIndexingLocationTest.php create mode 100644 tests/lib/Integration/API/DescendantIndexingObjectStateTest.php create mode 100644 tests/lib/Integration/API/DescendantIndexingSectionTest.php delete mode 100644 tests/lib/Integration/API/DescendantIndexingTest.php create mode 100644 tests/lib/Integration/API/DescendantIndexingTrashTest.php create mode 100644 tests/lib/Integration/Implementation/Solr/FieldMapper/LocationPriorityFieldMapper.php create mode 100644 tests/lib/Integration/Implementation/Solr/FieldMapper/ObjectStateFieldMapper.php create mode 100644 tests/lib/Integration/Implementation/Solr/FieldMapper/SectionFieldMapper.php diff --git a/tests/lib/Integration/API/DescendantIndexingContentTest.php b/tests/lib/Integration/API/DescendantIndexingContentTest.php new file mode 100644 index 00000000..7813ce4f --- /dev/null +++ b/tests/lib/Integration/API/DescendantIndexingContentTest.php @@ -0,0 +1,288 @@ +getRepository(); + $searchService = $repository->getSearchService(); + + $content = $this->createContentForTesting(); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($content['parentContentId']), + new Query\Criterion\FullText('šćenac'), + new Query\Criterion\FullText('more'), + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(1, $searchResult->totalCount); + + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals($parentContentFound->id, $content['parentContentId']); + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * + * @group delete + * @depends testPublishVersion + */ + public function testDeleteContent(): void + { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $searchService = $repository->getSearchService(); + + $content = $this->createContentForTesting(); + $grandChildContent = $contentService->loadContent($content['grandChildContentId']); + $parentContent = $contentService->loadContent($content['parentContentId']); + + $contentService->deleteContent($grandChildContent->contentInfo); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($parentContent->id), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * + * @depends testPublishVersion + */ + public function testDeleteTranslation(): void + { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $searchService = $repository->getSearchService(); + + $content = $this->createContentForTesting(); + $grandChildContent = $contentService->loadContent($content['grandChildContentId']); + $parentContent = $contentService->loadContent($content['parentContentId']); + + $contentService->deleteTranslation($grandChildContent->contentInfo, 'ger-DE'); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($parentContent->id), + new Query\Criterion\FullText('mogorush') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + } + + + public function testHideContent(): int + { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $searchService = $repository->getSearchService(); + + $content = $this->createContentForTesting(); + $grandChildContent = $contentService->loadContent($content['grandChildContentId']); + $parentContent = $contentService->loadContent($content['parentContentId']); + + $contentService->hideContent($grandChildContent->contentInfo); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($parentContent->id), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + + return $grandChildContent->id; + } + + /** + * @return void + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * + * @depends testHideContent + */ + public function testRevealContent(int $hiddenContentId): void + { + $repository = $this->getRepository(false); + $contentService = $repository->getContentService(); + $searchService = $repository->getSearchService(); + + $hiddenContent = $contentService->loadContent($hiddenContentId); + $parentLocation = $hiddenContent->contentInfo->getMainLocation()->getParentLocation()->getParentLocation(); + + $contentService->revealContent($hiddenContent->contentInfo); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($parentLocation->contentId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals(1, $searchResult->totalCount); + self::assertEquals($parentContentFound->id, $parentLocation->contentId); + + } + + public function testUpdateContentMetadataHandler(): void + { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $searchService = $repository->getSearchService(); + + $content = $this->createContentForTesting(); + $grandChildContent = $contentService->loadContent($content['grandChildContentId']); + $parentContent = $contentService->loadContent($content['parentContentId']); + + // Creates a metadata update struct + $metadataUpdate = $contentService->newContentMetadataUpdateStruct(); + + $metadataUpdate->remoteId = 'aaaabbbbccccddddeeeeffff11112222'; + $metadataUpdate->mainLanguageCode = 'eng-GB'; + $metadataUpdate->alwaysAvailable = false; + $metadataUpdate->publishedDate = $this->createDateTime(441759600); // 1984/01/01 + $metadataUpdate->modificationDate = $this->createDateTime(441759600); // 1984/01/01 + + // Update the metadata of the published content object + $grandChildContent = $contentService->updateContentMetadata( + $grandChildContent->contentInfo, + $metadataUpdate + ); + + + $this->assertInstanceOf( + Content::class, + $grandChildContent + ); + + } + + + private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + + $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); + $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; + $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; + $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); + $fieldDefinitionCreateStruct->position = 0; + $fieldDefinitionCreateStruct->isSearchable = true; + $contentTypeCreateStruct->addFieldDefinition($fieldDefinitionCreateStruct); + $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); + $contentTypeService->publishContentTypeDraft($contentTypeDraft); + + return $contentTypeService->loadContentTypeByIdentifier($identifier); + + } + + private function createContentForTesting() { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $contentTypeService = $repository->getContentTypeService(); + $locationService = $repository->getLocationService(); + + $contentType = $this->createContentType($contentTypeService, 'descendant_indexing_test'); + $contentType2 = $this->createContentType($contentTypeService, 'descendant_indexing_test_2'); + $contentType3 = $this->createContentType($contentTypeService, 'descendant_indexing_test_3'); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'mogoruš'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $parentContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $parentLocation = $parentContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType2, 'eng-GB'); + $contentCreateStruct->setField('name', 'šćenac'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $childContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $childLocation = $childContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($childLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType3, 'eng-GB'); + $contentCreateStruct->setField('name', 'more'); + //for testDeleteTranslation() + $contentCreateStruct->setField('name', 'mogorush', 'ger-DE'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $grandChildContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + + return [ + 'parentContentId' => $parentContentCreated->id, + 'childContentId' => $childContentCreated->id, + 'grandChildContentId' => $grandChildContentCreated->id + ]; + } + +} diff --git a/tests/lib/Integration/API/DescendantIndexingLocationTest.php b/tests/lib/Integration/API/DescendantIndexingLocationTest.php new file mode 100644 index 00000000..b4560fbe --- /dev/null +++ b/tests/lib/Integration/API/DescendantIndexingLocationTest.php @@ -0,0 +1,471 @@ +getRepository(); + $searchService = $repository->getSearchService(); + $sectionService = $repository->getSectionService(); + + $mediaSectionId = $this->generateId('section', 3); + + /* BEGIN: Use Case */ + $locationService = $repository->getLocationService(); + + // Load a location instance + $locations = $this->createLocationsForTesting(); + $childLocationId = $locations['childLocationId']; + $parentLocationId = $locations['parentLocationId']; + $grandChildLocationId = $locations['grandChildLocationId']; + + $parentLocation = $locationService->loadLocation($parentLocationId); + // Load the "Media" section + $section = $sectionService->loadSection($mediaSectionId); + + // Assign Section to ContentInfo + $sectionService->assignSectionToSubtree($parentLocation, $section); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\CustomField( + 'ng_child_section_field_1_i', + Operator::EQ, + $mediaSectionId), + new Query\Criterion\SectionId($mediaSectionId), + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(1, $searchResult->totalCount); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + self::assertEquals($parentLocation->contentId, $parentContentFound->id); + + } + + + public function testCopySubtree() + { + $repository = $this->getRepository(); + $locationService = $repository->getLocationService(); + $searchService = $repository->getSearchService(); + + $locations = $this->createLocationsForTesting(); + $childLocationId = $locations['childLocationId']; + $siblingLocationId = $locations['siblingLocationId']; + + // Load location to copy + $locationToCopy = $locationService->loadLocation($childLocationId); + + // Load new parent location + $newParentLocation = $locationService->loadLocation($siblingLocationId); + + $locationService->copySubtree( + $locationToCopy, + $newParentLocation + ); + + $siblingLocation = $locationService->loadLocation($siblingLocationId); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($siblingLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals(1, $searchResult->totalCount); + self::assertEquals($siblingLocation->contentId, $parentContentFound->id); + + } + + public function testCreateLocation() + { + $repository = $this->getRepository(); + $searchService = $repository->getSearchService(); + $locationService = $repository->getLocationService(); + + $locations = $this->createLocationsForTesting(); + $parentLocationId = $locations['parentLocationId']; + + $parentLocation = $locationService->loadLocation($parentLocationId); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals(1, $searchResult->totalCount); + self::assertEquals($parentContentFound->id, $parentLocation->contentId); + } + + public function testDeleteLocation() + { + $repository = $this->getRepository(); + $searchService = $repository->getSearchService(); + $locationService = $repository->getLocationService(); + + $locations = $this->createLocationsForTesting(); + $parentLocationId = $locations['parentLocationId']; + $grandChildLocationId = $locations['grandChildLocationId']; + $grandChildLocation = $locationService->loadLocation($grandChildLocationId); + + $locationService->deleteLocation($grandChildLocation); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + } + + + public function testMoveSubtree() + { + $repository = $this->getRepository(); + $locationService = $repository->getLocationService(); + $searchService = $repository->getSearchService(); + + $locations = $this->createLocationsForTesting(); + $parentLocationId = $locations['parentLocationId']; + $childLocationId = $locations['childLocationId']; + $siblingLocationId = $locations['siblingLocationId']; + $grandChildLocationId = $locations['grandChildLocationId']; + + // Load location to copy + $locationToMove = $locationService->loadLocation($childLocationId); + + // Load new parent location + $newParentLocation = $locationService->loadLocation($siblingLocationId); + + $locationService->moveSubtree( + $locationToMove, + $newParentLocation + ); + + $siblingLocation = $locationService->loadLocation($siblingLocationId); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($siblingLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals(1, $searchResult->totalCount); + self::assertEquals($siblingLocation->contentId, $parentContentFound->id); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + } + + /** + * @return void + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @group swap + */ + public function testSwapLocation() + { + $repository = $this->getRepository(); + $locationService = $repository->getLocationService(); + $searchService = $repository->getSearchService(); + + $locations = $this->createLocationsForTesting(); + + $siblingLocationId = $locations['siblingLocationId']; + $grandChildLocationId = $locations['grandChildLocationId']; + $parentLocationId = $locations['parentLocationId']; + + $siblingLocation = $locationService->loadLocation($siblingLocationId); + $grandChildLocation = $locationService->loadLocation($grandChildLocationId); + + $locationService->swapLocation( + $siblingLocation, + $grandChildLocation + ); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\FullText('sibling') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + } + + public function testHideLocation() + { + $repository = $this->getRepository(); + $searchService = $repository->getSearchService(); + $locationService = $repository->getLocationService(); + + $locations = $this->createLocationsForTesting(); + $parentLocationId = $locations['parentLocationId']; + $grandChildLocationId = $locations['grandChildLocationId']; + $grandChildLocation = $locationService->loadLocation($grandChildLocationId); + + $locationService->hideLocation($grandChildLocation); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + + return [ + 'parentLocationId' => $parentLocationId, + 'grandChildLocationId' => $grandChildLocationId + ]; + } + + /** + * @return void + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * + * @depends testHideLocation + */ + public function testUnhideLocation(array $locations) + { + $repository = $this->getRepository(false); + $searchService = $repository->getSearchService(); + $locationService = $repository->getLocationService(); + + $parentLocationId = $locations['parentLocationId']; + $grandChildLocationId = $locations['grandChildLocationId']; + $grandChildLocation = $locationService->loadLocation($grandChildLocationId); + + $parentLocation = $locationService->loadLocation($parentLocationId); + + $locationService->unhideLocation($grandChildLocation); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals(1, $searchResult->totalCount); + self::assertEquals($parentLocation->contentId, $parentContentFound->id); + } + + /** + * @return void + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @group update-location + */ + public function testUpdateLocation() + { + $repository = $this->getRepository(); + $locationService = $repository->getLocationService(); + $searchService = $repository->getSearchService(); + + $locations = $this->createLocationsForTesting(); + $grandChildLocationId = $locations['grandChildLocationId']; + $parentLocationId = $locations['parentLocationId']; + + $grandChildLocation = $locationService->loadLocation($grandChildLocationId); + $parentLocation = $locationService->loadLocation($parentLocationId); + + $updateStruct = $locationService->newLocationUpdateStruct(); + $updateStruct->priority = 3; + + $updatedLocation = $locationService->updateLocation($grandChildLocation, $updateStruct); + + $this->refreshSearch($repository); + + $query = new LocationQuery([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\CustomField( + 'ng_child_location_priority_field_2_i', + Operator::EQ, + 3) + ]), + ]); + + $searchResult = $searchService->findLocations($query); + self::assertEquals(1, $searchResult->totalCount); + + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals($parentLocation->contentId, $parentContentFound->contentInfo->id); + } + + private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); + $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; + $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; + $contentTypeCreateStruct->isContainer = true; + $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); + $fieldDefinitionCreateStruct->position = 0; + $fieldDefinitionCreateStruct->isSearchable = true; + $contentTypeCreateStruct->addFieldDefinition($fieldDefinitionCreateStruct); + $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); + $contentTypeService->publishContentTypeDraft($contentTypeDraft); + + return $contentTypeService->loadContentTypeByIdentifier($identifier); + + } + + /** + * @throws ContentFieldValidationException + * @throws InvalidArgumentException + * @throws BadStateException + * @throws ContentValidationException + * @throws UnauthorizedException + */ + private function createLocationsForTesting() { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $contentTypeService = $repository->getContentTypeService(); + $locationService = $repository->getLocationService(); + + $contentType = $this->createContentType($contentTypeService, 'descendant_indexing_test'); + $contentType2 = $this->createContentType($contentTypeService, 'descendant_indexing_test_2'); + $contentType3 = $this->createContentType($contentTypeService, 'descendant_indexing_test_3'); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'mogoruš'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $parentContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $parentLocation = $parentContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'sibling'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $siblingLocationCreated = $contentService->publishVersion($contentDraft->versionInfo); + $siblingLocation = $siblingLocationCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType2, 'eng-GB'); + $contentCreateStruct->setField('name', 'šćenac'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $childContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $childLocation = $childContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($childLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType3, 'eng-GB'); + $contentCreateStruct->setField('name', 'more'); + $contentCreateStruct->setField('name', 'mogorush', 'ger-DE'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $grandChildContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $grandChildLocation = $grandChildContentCreated->contentInfo->getMainLocation(); + + return [ + 'parentLocationId' => $parentLocation->id, + 'siblingLocationId' => $siblingLocation->id, + 'childLocationId' => $childLocation->id, + 'grandChildLocationId' => $grandChildLocation->id + ]; + } +} diff --git a/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php new file mode 100644 index 00000000..b0f58e3d --- /dev/null +++ b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php @@ -0,0 +1,114 @@ +getRepository(); + $contentService = $this->getRepository()->getContentService(); + $searchService = $this->getRepository()->getSearchService(); + $objectStateService = $this->getRepository()->getObjectStateService(); + + $content = $this->createContentForTesting(); + $grandChildContentId = $content['grandChildContentId']; + $parentContentId = $content['parentContentId']; + $grandChildContent = $contentService->loadContent($grandChildContentId); + $parentContent = $contentService->loadContent($parentContentId); + + $stateGroup = $objectStateService->loadObjectStateGroupByIdentifier( + "ez_lock", + ); + + $lockedState = $objectStateService->loadObjectStateByIdentifier($stateGroup, 'locked'); + + $objectStateService->setContentState($grandChildContent->contentInfo, $stateGroup, $lockedState); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentContent->contentInfo->mainLocationId), + new Query\Criterion\CustomField( + 'ng_child_object_state_2_s', + Operator::EQ, + $lockedState->identifier + ) + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(1, $searchResult->totalCount); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + self::assertEquals($parentContentId, $parentContentFound->id); + } + + + private function createContentForTesting() { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $contentTypeService = $repository->getContentTypeService(); + $locationService = $repository->getLocationService(); + + $contentType = $this->createContentType($contentTypeService, 'descendant_indexing_test'); + $contentType2 = $this->createContentType($contentTypeService, 'descendant_indexing_test_2'); + $contentType3 = $this->createContentType($contentTypeService, 'descendant_indexing_test_3'); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'mogoruš'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $parentContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $parentLocation = $parentContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType2, 'eng-GB'); + $contentCreateStruct->setField('name', 'šćenac'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $childContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $childLocation = $childContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($childLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType3, 'eng-GB'); + $contentCreateStruct->setField('name', 'more'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $grandChildContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + + return [ + 'parentContentId' => $parentContentCreated->id, + 'childContentId' => $childContentCreated->id, + 'grandChildContentId' => $grandChildContentCreated->id + ]; + } + + private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); + $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; + $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; + $contentTypeCreateStruct->isContainer = true; + $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); + $fieldDefinitionCreateStruct->position = 0; + $fieldDefinitionCreateStruct->isSearchable = true; + $contentTypeCreateStruct->addFieldDefinition($fieldDefinitionCreateStruct); + $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); + $contentTypeService->publishContentTypeDraft($contentTypeDraft); + + return $contentTypeService->loadContentTypeByIdentifier($identifier); + + } +} diff --git a/tests/lib/Integration/API/DescendantIndexingSectionTest.php b/tests/lib/Integration/API/DescendantIndexingSectionTest.php new file mode 100644 index 00000000..c8bb115f --- /dev/null +++ b/tests/lib/Integration/API/DescendantIndexingSectionTest.php @@ -0,0 +1,134 @@ +getRepository(); + $searchService = $repository->getSearchService(); + $sectionService = $repository->getSectionService(); + $locationService = $repository->getLocationService(); + + $mediaSectionId = $this->generateId('section', 3); + + $locations = $this->createLocationsForTesting(); + $childLocationId = $locations['childLocationId']; + $parentLocationId = $locations['parentLocationId']; + + $parentLocation = $locationService->loadLocation($parentLocationId); + $childLocation = $locationService->loadLocation($childLocationId); + + $section = $sectionService->loadSection($mediaSectionId); + + $sectionService->assignSection($childLocation->contentInfo, $section); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\LocationId($parentLocationId), + new Query\Criterion\CustomField( + 'ng_child_section_field_1_i', + Operator::EQ, + $mediaSectionId) + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(1, $searchResult->totalCount); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + self::assertEquals($parentLocation->contentId, $parentContentFound->id); + } + + + /** + * @throws ContentFieldValidationException + * @throws InvalidArgumentException + * @throws BadStateException + * @throws ContentValidationException + * @throws UnauthorizedException + */ + private function createLocationsForTesting() { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $contentTypeService = $repository->getContentTypeService(); + $locationService = $repository->getLocationService(); + + $contentType = $this->createContentType($contentTypeService, 'descendant_indexing_test'); + $contentType2 = $this->createContentType($contentTypeService, 'descendant_indexing_test_2'); + $contentType3 = $this->createContentType($contentTypeService, 'descendant_indexing_test_3'); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'mogoruš'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $parentContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $parentLocation = $parentContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'sibling'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $siblingLocationCreated = $contentService->publishVersion($contentDraft->versionInfo); + $siblingLocation = $siblingLocationCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType2, 'eng-GB'); + $contentCreateStruct->setField('name', 'šćenac'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $childContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $childLocation = $childContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($childLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType3, 'eng-GB'); + $contentCreateStruct->setField('name', 'more'); + $contentCreateStruct->setField('name', 'mogorush', 'ger-DE'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $grandChildContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $grandChildLocation = $grandChildContentCreated->contentInfo->getMainLocation(); + + return [ + 'parentLocationId' => $parentLocation->id, + 'siblingLocationId' => $siblingLocation->id, + 'childLocationId' => $childLocation->id, + 'grandChildLocationId' => $grandChildLocation->id + ]; + } + + private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); + $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; + $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; + $contentTypeCreateStruct->isContainer = true; + $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); + $fieldDefinitionCreateStruct->position = 0; + $fieldDefinitionCreateStruct->isSearchable = true; + $contentTypeCreateStruct->addFieldDefinition($fieldDefinitionCreateStruct); + $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); + $contentTypeService->publishContentTypeDraft($contentTypeDraft); + + return $contentTypeService->loadContentTypeByIdentifier($identifier); + + } +} diff --git a/tests/lib/Integration/API/DescendantIndexingTest.php b/tests/lib/Integration/API/DescendantIndexingTest.php deleted file mode 100644 index 38709d4c..00000000 --- a/tests/lib/Integration/API/DescendantIndexingTest.php +++ /dev/null @@ -1,77 +0,0 @@ -getRepository(); - $contentService = $repository->getContentService(); - $contentTypeService = $repository->getContentTypeService(); - $locationService = $repository->getLocationService(); - $searchService = $repository->getSearchService(); - - $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); - $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct('descendant_indexing_test'); - $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; - $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; - $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); - $fieldDefinitionCreateStruct->position = 0; - $fieldDefinitionCreateStruct->isSearchable = true; - $contentTypeCreateStruct->addFieldDefinition($fieldDefinitionCreateStruct); - $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); - $contentTypeService->publishContentTypeDraft($contentTypeDraft); - - $contentType = $contentTypeService->loadContentTypeByIdentifier('descendant_indexing_test'); - - $locationCreateStruct = $locationService->newLocationCreateStruct(2); - $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); - $contentCreateStruct->setField('name', 'mogoruš'); - $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); - $parentContentCreated = $contentService->publishVersion($contentDraft->versionInfo); - $parentLocation = $parentContentCreated->contentInfo->getMainLocation(); - - $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id); - $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); - $contentCreateStruct->setField('name', 'šćenac'); - $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); - $contentService->publishVersion($contentDraft->versionInfo); - - $this->refreshSearch($repository); - - $query = new Query([ - 'filter' => new Query\Criterion\LogicalAnd([ - new Query\Criterion\ContentId($parentContentCreated->id), - new Query\Criterion\FullText('šćenac'), - ]), - ]); - - $searchResult = $searchService->findContent($query); - - self::assertEquals(1, $searchResult->totalCount); - - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ - $parentContentFound = $searchResult->searchHits[0]->valueObject; - - self::assertEquals($parentContentFound->id, $parentContentCreated->id); - } -} diff --git a/tests/lib/Integration/API/DescendantIndexingTrashTest.php b/tests/lib/Integration/API/DescendantIndexingTrashTest.php new file mode 100644 index 00000000..62c3bb79 --- /dev/null +++ b/tests/lib/Integration/API/DescendantIndexingTrashTest.php @@ -0,0 +1,158 @@ +getRepository(); + $contentService = $repository->getContentService(); + $searchService = $repository->getSearchService(); + $trashService = $repository->getTrashService(); + + $content = $this->createContentForTesting(); + $grandChildContent = $contentService->loadContent($content['grandChildContentId']); + $parentContent = $contentService->loadContent($content['parentContentId']); + + $trashItem = $trashService->trash($grandChildContent->contentInfo->getMainLocation()); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($parentContent->id), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + + self::assertEquals(0, $searchResult->totalCount); + + return [ + "trashItem" => $trashItem, + "content" => $content + ]; + } + + /** + * @param array $sharedObjects + * @return void + * @throws InvalidArgumentException + * @throws InvalidCriterionArgumentException + * @throws NotFoundException + * @throws UnauthorizedException + * @depends testTrash + */ + public function testRecover(array $sharedObjects): void + { + $trashItem = $sharedObjects['trashItem']; + $content = $sharedObjects['content']; + + $repository = $this->getRepository(false); + $contentService = $repository->getContentService(); + $searchService = $repository->getSearchService(); + $trashService = $repository->getTrashService(); + + $parentContent = $contentService->loadContent($content['parentContentId']); + + $location = $trashService->recover($trashItem); + + $this->refreshSearch($repository); + + $query = new Query([ + 'filter' => new Query\Criterion\LogicalAnd([ + new Query\Criterion\ContentId($parentContent->id), + new Query\Criterion\FullText('more') + ]), + ]); + + $searchResult = $searchService->findContent($query); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $parentContentFound */ + $parentContentFound = $searchResult->searchHits[0]->valueObject; + + self::assertEquals(1, $searchResult->totalCount); + self::assertEquals($parentContentFound->id, $parentContent->id); + } + + + + private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + + $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); + $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); + $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; + $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; + $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); + $fieldDefinitionCreateStruct->position = 0; + $fieldDefinitionCreateStruct->isSearchable = true; + $contentTypeCreateStruct->addFieldDefinition($fieldDefinitionCreateStruct); + $contentTypeDraft = $contentTypeService->createContentType($contentTypeCreateStruct, [reset($contentTypeGroups)]); + $contentTypeService->publishContentTypeDraft($contentTypeDraft); + + return $contentTypeService->loadContentTypeByIdentifier($identifier); + + } + + private function createContentForTesting() { + $repository = $this->getRepository(); + $contentService = $repository->getContentService(); + $contentTypeService = $repository->getContentTypeService(); + $locationService = $repository->getLocationService(); + + $contentType = $this->createContentType($contentTypeService, 'descendant_indexing_test'); + $contentType2 = $this->createContentType($contentTypeService, 'descendant_indexing_test_2'); + $contentType3 = $this->createContentType($contentTypeService, 'descendant_indexing_test_3'); + + $locationCreateStruct = $locationService->newLocationCreateStruct(2); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $contentCreateStruct->setField('name', 'mogoruš'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $parentContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $parentLocation = $parentContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType2, 'eng-GB'); + $contentCreateStruct->setField('name', 'šćenac'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $childContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + $childLocation = $childContentCreated->contentInfo->getMainLocation(); + + $locationCreateStruct = $locationService->newLocationCreateStruct($childLocation->id); + $contentCreateStruct = $contentService->newContentCreateStruct($contentType3, 'eng-GB'); + $contentCreateStruct->setField('name', 'more'); + //for testDeleteTranslation() + $contentCreateStruct->setField('name', 'mogorush', 'ger-DE'); + $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); + $grandChildContentCreated = $contentService->publishVersion($contentDraft->versionInfo); + + return [ + 'parentContentId' => $parentContentCreated->id, + 'childContentId' => $childContentCreated->id, + 'grandChildContentId' => $grandChildContentCreated->id + ]; + } + +} diff --git a/tests/lib/Integration/Implementation/Solr/FieldMapper/LocationPriorityFieldMapper.php b/tests/lib/Integration/Implementation/Solr/FieldMapper/LocationPriorityFieldMapper.php new file mode 100644 index 00000000..ab4db1e3 --- /dev/null +++ b/tests/lib/Integration/Implementation/Solr/FieldMapper/LocationPriorityFieldMapper.php @@ -0,0 +1,151 @@ + + */ + private array $contentTypeIdIdentifierCache; + + /** + * @param array $configuration + */ + public function __construct( + private readonly ContentTypeHandler $contentTypeHandler, + private readonly ContentHandler $contentHandler, + private readonly Handler $contentFilteringHandler, + private readonly LocationHandler $locationHandler, + private readonly array $configuration, + private readonly int $childrenLimit = 99, + ) { + parent::__construct( + $contentHandler, + $contentTypeHandler, + $this->configuration, + ); + } + + public function doAccept(SPILocation $location): bool + { + return true; + } + + /** + * @param string $languageCode + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * + * @return \Ibexa\Contracts\Core\Search\Field[] + */ + public function mapFields(SPILocation $location): array + { + $content = $this->contentHandler->load($location->contentId); + $contentInfo = $content->versionInfo->contentInfo; + $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; + $contentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); + $childrenConfiguration = $this->configuration['map'][$contentTypeIdentifier]['children']; + $contentTypeIdentifier = array_keys($childrenConfiguration)[0]; + $filter = new Filter(); + $filter + ->withCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($contentTypeIdentifier), + new ParentLocationId($contentInfo->mainLocationId), + ]) + ); + + $contentItemList = $this->contentFilteringHandler->find($filter); + $fieldsGrouped = [[]]; + + foreach ($contentItemList as $contentItem) { + $contentTypeId = $contentItem->contentInfo->contentTypeId; + $childContentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); + + $childConfiguration = $childrenConfiguration[$childContentTypeIdentifier] ?? []; + $childLocation = $this->locationHandler->load($contentItem->contentInfo->mainLocationId); + + if (isset($childConfiguration['indexed']) && $childConfiguration['indexed'] === true) { + $fieldsGrouped[] = [ + new Field( + 'ng_child_location_priority_field_1', + $childLocation->priority, + new IntegerField(), + ), + ]; + } + + $grandChildContentTypeIdentifier = array_keys($childConfiguration['children'])[0]; + $filter = new Filter(); + $filter + ->withCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($grandChildContentTypeIdentifier), + new ParentLocationId($contentItem->contentInfo->mainLocationId), + ]) + ) + ->withLimit($this->childrenLimit); + + $grandChildContentItemList = $this->contentFilteringHandler->find($filter); + foreach ($grandChildContentItemList as $grandChildContentItem) { + $grandChildConfiguration = $childConfiguration['children'][$grandChildContentTypeIdentifier] ?? []; + $grandChildLocation = $this->locationHandler->load($grandChildContentItem->contentInfo->mainLocationId); + if (isset($grandChildConfiguration['indexed']) && $grandChildConfiguration['indexed'] === true) { + $fieldsGrouped[] = [ + new Field( + 'ng_child_location_priority_field_2', + $grandChildLocation->priority, + new IntegerField(), + ), + ]; + + } + + } + + } + + return array_merge(...$fieldsGrouped); + } + + public function getIdentifier(): string + { + return 'ng_descendant_indexing_location_priority'; + } + + private function getContentTypeIdentifier(int $contentTypeId): ?string + { + if (isset($this->contentTypeIdIdentifierCache[$contentTypeId])) { + return $this->contentTypeIdIdentifierCache[$contentTypeId]; + } + + try { + $contentType = $this->contentTypeHandler->load($contentTypeId); + $identifier = $contentType->identifier; + } catch (NotFoundException) { + $identifier = null; + } + + $this->contentTypeIdIdentifierCache[$contentTypeId] = $identifier; + + return $identifier; + } + +} diff --git a/tests/lib/Integration/Implementation/Solr/FieldMapper/ObjectStateFieldMapper.php b/tests/lib/Integration/Implementation/Solr/FieldMapper/ObjectStateFieldMapper.php new file mode 100644 index 00000000..325c87f2 --- /dev/null +++ b/tests/lib/Integration/Implementation/Solr/FieldMapper/ObjectStateFieldMapper.php @@ -0,0 +1,160 @@ + + */ + private array $contentTypeIdIdentifierCache; + + /** + * @param array $configuration + */ + public function __construct( + private readonly ContentTypeHandler $contentTypeHandler, + private readonly Handler $contentFilteringHandler, + private readonly ObjectStateHandler $objectStateHandler, + private readonly array $configuration, + private readonly int $childrenLimit = 99, + ) { + parent::__construct( + $contentTypeHandler, + $this->configuration, + ); + } + + public function doAccept(Content $content): bool + { + return true; + } + + /** + * @param string $languageCode + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * + * @return \Ibexa\Contracts\Core\Search\Field[] + */ + public function mapFields(Content $content): array + { + $contentInfo = $content->versionInfo->contentInfo; + $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; + $contentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); + + $childrenConfiguration = $this->configuration['map'][$contentTypeIdentifier]['children']; + $contentTypeIdentifier = array_keys($childrenConfiguration)[0]; + $filter = new Filter(); + $filter + ->withCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($contentTypeIdentifier), + new ParentLocationId($contentInfo->mainLocationId), + ]) + ); + + $contentItemList = $this->contentFilteringHandler->find($filter); + $fieldsGrouped = [[]]; + + foreach ($contentItemList as $contentItem) { + $contentTypeId = $contentItem->contentInfo->contentTypeId; + $childContentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); + + $childConfiguration = $childrenConfiguration[$childContentTypeIdentifier] ?? []; + $stateGroup = $this->objectStateHandler->loadGroupByIdentifier( + "ez_lock", + ); + $objectState = $this->objectStateHandler->getContentState( + $contentItem->contentInfo->id, + $stateGroup->id, + ); + if (isset($childConfiguration['indexed']) && $childConfiguration['indexed'] === true) { + $fieldsGrouped[] = [ + new Field( + 'ng_child_object_state_1', + $objectState->identifier, + new StringField(), + ), + ]; + } + + $grandChildContentTypeIdentifier = array_keys($childConfiguration['children'])[0]; + $filter = new Filter(); + $filter + ->withCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($grandChildContentTypeIdentifier), + new ParentLocationId($contentItem->contentInfo->mainLocationId), + ]) + ) + ->withLimit($this->childrenLimit); + + $grandChildContentItemList = $this->contentFilteringHandler->find($filter); + foreach ($grandChildContentItemList as $grandChildContentItem) { + + $stateGroup = $this->objectStateHandler->loadGroupByIdentifier( + "ez_lock", + ); + $objectState = $this->objectStateHandler->getContentState( + $grandChildContentItem->contentInfo->id, + $stateGroup->id, + ); + + $grandChildConfiguration = $childConfiguration['children'][$grandChildContentTypeIdentifier] ?? []; + if (isset($grandChildConfiguration['indexed']) && $grandChildConfiguration['indexed'] === true) { + $fieldsGrouped[] = [ + new Field( + 'ng_child_object_state_2', + $objectState->identifier, + new StringField(), + ), + ]; + + } + + } + + } + + return array_merge(...$fieldsGrouped); + } + + public function getIdentifier(): string + { + return 'ng_descendant_indexing_object_state'; + } + + private function getContentTypeIdentifier(int $contentTypeId): ?string + { + if (isset($this->contentTypeIdIdentifierCache[$contentTypeId])) { + return $this->contentTypeIdIdentifierCache[$contentTypeId]; + } + + try { + $contentType = $this->contentTypeHandler->load($contentTypeId); + $identifier = $contentType->identifier; + } catch (NotFoundException) { + $identifier = null; + } + + $this->contentTypeIdIdentifierCache[$contentTypeId] = $identifier; + + return $identifier; + } +} diff --git a/tests/lib/Integration/Implementation/Solr/FieldMapper/SectionFieldMapper.php b/tests/lib/Integration/Implementation/Solr/FieldMapper/SectionFieldMapper.php new file mode 100644 index 00000000..89ce1ac6 --- /dev/null +++ b/tests/lib/Integration/Implementation/Solr/FieldMapper/SectionFieldMapper.php @@ -0,0 +1,143 @@ + + */ + private array $contentTypeIdIdentifierCache; + + /** + * @param array $configuration + */ + public function __construct( + private readonly ContentTypeHandler $contentTypeHandler, + private readonly Handler $contentFilteringHandler, + private readonly array $configuration, + private readonly int $childrenLimit = 99, + ) { + parent::__construct( + $contentTypeHandler, + $this->configuration, + ); + } + + public function doAccept(Content $content): bool + { + return true; + } + + /** + * @param string $languageCode + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * + * @return \Ibexa\Contracts\Core\Search\Field[] + */ + public function mapFields(Content $content): array + { + $contentInfo = $content->versionInfo->contentInfo; + $contentTypeId = $content->versionInfo->contentInfo->contentTypeId; + $contentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); + + $childrenConfiguration = $this->configuration['map'][$contentTypeIdentifier]['children']; + $contentTypeIdentifier = array_keys($childrenConfiguration)[0]; + $filter = new Filter(); + $filter + ->withCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($contentTypeIdentifier), + new ParentLocationId($contentInfo->mainLocationId), + ]) + ); + + $contentItemList = $this->contentFilteringHandler->find($filter); + $fieldsGrouped = [[]]; + + foreach ($contentItemList as $contentItem) { + $contentTypeId = $contentItem->contentInfo->contentTypeId; + $childContentTypeIdentifier = $this->getContentTypeIdentifier($contentTypeId); + + $childConfiguration = $childrenConfiguration[$childContentTypeIdentifier] ?? []; + + if (isset($childConfiguration['indexed']) && $childConfiguration['indexed'] === true) { + $fieldsGrouped[] = [ + new Field( + 'ng_child_section_field_1', + $contentItem->contentInfo->sectionId, + new IntegerField(), + ), + ]; + } + + $grandChildContentTypeIdentifier = array_keys($childConfiguration['children'])[0]; + $filter = new Filter(); + $filter + ->withCriterion( + new LogicalAnd([ + new ContentTypeIdentifier($grandChildContentTypeIdentifier), + new ParentLocationId($contentItem->contentInfo->mainLocationId), + ]) + ) + ->withLimit($this->childrenLimit); + + $grandChildContentItemList = $this->contentFilteringHandler->find($filter); + foreach ($grandChildContentItemList as $grandChildContentItem) { + $grandChildConfiguration = $childConfiguration['children'][$grandChildContentTypeIdentifier] ?? []; + if (isset($grandChildConfiguration['indexed']) && $grandChildConfiguration['indexed'] === true) { + $fieldsGrouped[] = [ + new Field( + 'ng_child_section_field_2', + $grandChildContentItem->contentInfo->sectionId, + new IntegerField(), + ), + ]; + + } + + } + + } + + return array_merge(...$fieldsGrouped); + } + + public function getIdentifier(): string + { + return 'ng_descendant_indexing_section'; + } + + private function getContentTypeIdentifier(int $contentTypeId): ?string + { + if (isset($this->contentTypeIdIdentifierCache[$contentTypeId])) { + return $this->contentTypeIdIdentifierCache[$contentTypeId]; + } + + try { + $contentType = $this->contentTypeHandler->load($contentTypeId); + $identifier = $contentType->identifier; + } catch (NotFoundException) { + $identifier = null; + } + + $this->contentTypeIdIdentifierCache[$contentTypeId] = $identifier; + + return $identifier; + } +} diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 554bee97..e062d75a 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -3,35 +3,19 @@ parameters: enabled: true handlers: - ng_descendant_indexing_fulltext + - ng_descendant_indexing_location_priority + - ng_descendant_indexing_section + - ng_descendant_indexing_object_state map: descendant_indexing_test: children: - descendant_indexing_test: + descendant_indexing_test_2: indexed: true + children: + descendant_indexing_test_3: + indexed: true services: - netgen_search_extra.descendant_indexing.field_mapper.fulltext: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldMapper - arguments: - - '@netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation.fulltext_field_resolver.native' - - '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler' - - '@Ibexa\Contracts\Core\Persistence\Content\Handler' - - '@Ibexa\Contracts\Core\Persistence\Filter\Content\Handler' - - '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler' - - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' - tags: - - { name: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation } - - netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content.translation: - class: Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper - arguments: - - '%netgen.ibexa_search_extra.descendant_indexing.configuration%' - - - - '@netgen_search_extra.descendant_indexing.field_mapper.fulltext' - - tags: - - { name: ibexa.search.solr.field.mapper.content.translation } - Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\CopyContentHandler: class: Netgen\IbexaSearchExtra\Core\Search\Common\Messenger\MessageHandler\Search\DescendantIndexing\Content\CopyContentHandler arguments: diff --git a/tests/lib/Integration/Resources/config/services.yaml b/tests/lib/Integration/Resources/config/services.yaml index 8edbc52a..2dc47e89 100644 --- a/tests/lib/Integration/Resources/config/services.yaml +++ b/tests/lib/Integration/Resources/config/services.yaml @@ -48,3 +48,41 @@ services: Ibexa\Bundle\Core\Routing\UrlAliasRouter: class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Stubs\RouterStub + + netgen.ibexa_search_extra.solr.field_mapper.location.location_priority: + class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\LocationPriorityFieldMapper + arguments: + [ + '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler', + '@Ibexa\Contracts\Core\Persistence\Content\Handler', + '@Ibexa\Core\Persistence\Legacy\Filter\Handler\ContentFilteringHandler', + '@Ibexa\Contracts\Core\Persistence\Content\Location\Handler', + '%netgen.ibexa_search_extra.descendant_indexing.configuration%' + ] + tags: + - { name: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.location } + + + netgen.ibexa_search_extra.solr.field_mapper.content.section: + class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\SectionFieldMapper + arguments: + [ + '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler', + '@Ibexa\Core\Persistence\Legacy\Filter\Handler\ContentFilteringHandler', + '%netgen.ibexa_search_extra.descendant_indexing.configuration%', + ] + tags: + - { name: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content } + + + netgen.ibexa_search_extra.solr.field_mapper.content.object_state: + class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\ObjectStateFieldMapper + arguments: + [ + '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler', + '@Ibexa\Core\Persistence\Legacy\Filter\Handler\ContentFilteringHandler', + '@Ibexa\Contracts\Core\Persistence\Content\ObjectState\Handler', + '%netgen.ibexa_search_extra.descendant_indexing.configuration%' + ] + tags: + - { name: netgen.ibexa_search_extra.solr.field_mapper.descendant_indexing.content } diff --git a/tests/lib/Integration/SetupFactory/SolrAsynchronous.php b/tests/lib/Integration/SetupFactory/SolrAsynchronous.php index 7a806923..1c2669f2 100644 --- a/tests/lib/Integration/SetupFactory/SolrAsynchronous.php +++ b/tests/lib/Integration/SetupFactory/SolrAsynchronous.php @@ -39,5 +39,7 @@ protected function externalBuildContainer(ContainerBuilder $containerBuilder): v $containerBuilder->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass()); $containerBuilder->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass()); $containerBuilder->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass()); + $containerBuilder->addCompilerPass(new Compiler\DescendantIndexingPass()); + } } From f71cbebe9f57a6d0e624b85a21291a18a4fccc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 11 Jul 2024 15:41:20 +0200 Subject: [PATCH 56/74] NGSTACK-836 AncestorIndexer and AncestorResolver changes and swap location handler fix --- .../DescendantIndexing/AncestorIndexer.php | 25 ++++++++- .../DescendantIndexing/AncestorResolver.php | 51 +++++++++++++++---- .../Location/SwapLocationHandler.php | 22 ++++++-- 3 files changed, 82 insertions(+), 16 deletions(-) diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorIndexer.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorIndexer.php index e43a2e90..af3ba129 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorIndexer.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorIndexer.php @@ -35,11 +35,34 @@ public function indexSingle(Location $location): void $this->searchHandler->indexLocation($ancestor); } + /** + * @param \Ibexa\Contracts\Core\Persistence\Content\Location $location + */ + public function indexSingleForSwapLocation(Location $location, Location $swappedLocation): void + { + $ancestor = $this->ancestorResolver->resolveAncestorForSwapLocation($location, $swappedLocation); + + if ($ancestor === null) { + return; + } + + try { + $content = $this->contentHandler->load($ancestor->contentId); + } catch (NotFoundException) { + return; + } + + $this->searchHandler->indexContent($content); + $this->searchHandler->indexLocation($ancestor); + } + /** * @param \Ibexa\Contracts\Core\Persistence\Content\Location $location */ public function indexSingleForParentLocation(Location $location): void { + $this->indexSingle($location); + $ancestor = $this->ancestorResolver->resolveAncestorForParentLocation($location); if ($ancestor === null) { @@ -71,8 +94,6 @@ public function indexMultiple(array $locations): void */ public function indexMultipleForParentLocation(array $locations): void { - $this->indexMultiple($locations); - foreach ($locations as $location) { $this->indexSingleForParentLocation($location); } diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php index 8e73657e..4c01e63c 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorResolver.php @@ -37,10 +37,28 @@ public function resolveAncestor(Location $location): ?Location do { $match = $this->matchPath($ancestry); - if ($match === 0) { + if ($match === true) { return end($ancestry); } - } while (is_int($match) && $this->addToAncestry($ancestry)); + } while (is_bool($match) && $this->addToAncestry($ancestry)); + + return null; + } + + public function resolveAncestorForSwapLocation(Location $location, Location $swappedLocation): ?Location + { + $contentInfo = $this->contentHandler->loadContentInfo($swappedLocation->contentId); + $contentType = $this->contentTypeHandler->load($contentInfo->contentTypeId); + $contentTypeIdentifier = $contentType->identifier; + $ancestry = [$location]; + + do { + $match = $this->matchPath($ancestry, $contentTypeIdentifier); + + if ($match === true) { + return end($ancestry); + } + } while (is_bool($match) && $this->addToAncestry($ancestry)); return null; } @@ -70,33 +88,46 @@ public function resolveAncestorForParentLocation(Location $location): ?Location * * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $ancestry */ - private function matchPath(array $ancestry): false|int + private function matchPath(array $ancestry, ?string $firstContentTypeIdentifier = null): ?bool { - $ancestryPath = $this->getAncestryPath($ancestry); + $ancestryPath = $this->getAncestryPath($ancestry, $firstContentTypeIdentifier); if ($ancestryPath === null) { return false; } + $isPartialMatch = false; foreach ($this->ancestorPathGenerator->getPaths() as $path) { - if (str_starts_with($path, $ancestryPath)) { - return mb_strlen($path) - mb_strlen($ancestryPath); + if (str_starts_with($path, $ancestryPath . '/')) { + $isPartialMatch = true; + } + + if ($path === $ancestryPath) { + return true; } } - return false; + if ($isPartialMatch) { + return false; + } + + return null; } /** * @param \Ibexa\Contracts\Core\Persistence\Content\Location[] $ancestry */ - private function getAncestryPath(array $ancestry): ?string + private function getAncestryPath(array $ancestry, ?string $firstContentTypeIdentifier = null): ?string { $pathElements = []; - foreach ($ancestry as $location) { + foreach ($ancestry as $index => $location) { try { - $pathElements[] = $this->getContentTypeIdentifier($location); + if ($index === 0 && $firstContentTypeIdentifier !== null) { + $pathElements[] = $firstContentTypeIdentifier; + } else { + $pathElements[] = $this->getContentTypeIdentifier($location); + } } catch (NotFoundException) { return null; } diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/SwapLocationHandler.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/SwapLocationHandler.php index db06ec37..df50b30c 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/SwapLocationHandler.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/Location/SwapLocationHandler.php @@ -23,11 +23,11 @@ public function __construct( public function __invoke(SwapLocation $message): void { - $this->reindexForLocation($message->location1Id); - $this->reindexForLocation($message->location2Id); + $this->reindexForLocation($message->location1Id, $message->location2Id); + $this->reindexForLocation($message->location2Id, $message->location1Id); } - private function reindexForLocation(int $locationId): void + private function reindexForLocation(int $locationId, int $swappedLocationId): void { try { $location = $this->locationHandler->load($locationId); @@ -43,6 +43,20 @@ private function reindexForLocation(int $locationId): void return; } - $this->ancestorIndexer->indexSingle($location); + try { + $swappedLocation = $this->locationHandler->load($swappedLocationId); + } catch (NotFoundException) { + $this->logger->info( + sprintf( + '%s: Location #%d is gone, aborting', + $this::class, + $swappedLocationId, + ), + ); + + return; + } + + $this->ancestorIndexer->indexSingleForSwapLocation($location, $swappedLocation); } } From 9e78499558a9e3e66494a80f748812203279a232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 11 Jul 2024 15:42:14 +0200 Subject: [PATCH 57/74] NGSTACK-836 remove unused qualifiers --- .../DescendantFieldMapper/FullTextFieldMapper.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldMapper.php index e8829d46..1632a4d7 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/FullTextFieldMapper.php @@ -17,11 +17,8 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; -use Ibexa\Contracts\Solr\FieldMapper\ContentTranslationFieldMapper; -use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\ContentTranslation\DescendantFieldMapper\FullTextFieldResolver; use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\IdentifiableFieldMapper; -use function array_key_exists; use function array_keys; use function array_merge; use function count; From 40014433c061978b157af40a2eb8e2b0ae39fb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 11 Jul 2024 16:00:34 +0200 Subject: [PATCH 58/74] NGSTACK-836 exclude descendant indexing tests (not supported with legacy search engine) --- phpunit-integration-legacy.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpunit-integration-legacy.xml b/phpunit-integration-legacy.xml index 5ae3be57..59e83ee6 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -23,6 +23,10 @@ tests/lib/Integration/API/DescendantIndexingTest.php tests/lib/Integration/Solr/RawFacetDomainTest.php tests/lib/Integration/Solr/RawFacetTest.php + tests/lib/Integration/Solr/DescendantIndexingContentTest.php + tests/lib/Integration/Solr/DescendantIndexingLocationTest.php + tests/lib/Integration/Solr/DescendantIndexingObjectStateTest.php + tests/lib/Integration/Solr/DescendantIndexingTrashTest.php From b8573045640e72eb0a0b6f580c384752b919dd3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 11 Jul 2024 16:34:20 +0200 Subject: [PATCH 59/74] NGSTACK-836 update tests throws tags --- .../API/DescendantIndexingContentTest.php | 50 +++++++++- .../API/DescendantIndexingLocationTest.php | 99 ++++++++++++++++--- .../API/DescendantIndexingObjectStateTest.php | 28 +++++- .../API/DescendantIndexingSectionTest.php | 28 +++++- 4 files changed, 176 insertions(+), 29 deletions(-) diff --git a/tests/lib/Integration/API/DescendantIndexingContentTest.php b/tests/lib/Integration/API/DescendantIndexingContentTest.php index 7813ce4f..13075c56 100644 --- a/tests/lib/Integration/API/DescendantIndexingContentTest.php +++ b/tests/lib/Integration/API/DescendantIndexingContentTest.php @@ -9,12 +9,10 @@ use Ibexa\Core\Repository\SiteAccessAware\ContentTypeService; use Ibexa\Tests\Integration\Core\Repository\BaseTest; -/** - * @group descendant-indexing - */ final class DescendantIndexingContentTest extends BaseTest { /** + * @return void * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException @@ -52,6 +50,7 @@ public function testPublishVersion() } /** + * @return void * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException @@ -61,7 +60,6 @@ public function testPublishVersion() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * - * @group delete * @depends testPublishVersion */ public function testDeleteContent(): void @@ -91,6 +89,7 @@ public function testDeleteContent(): void } /** + * @return void * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException @@ -129,6 +128,17 @@ public function testDeleteTranslation(): void } + /** + * @return int + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ public function testHideContent(): int { $repository = $this->getRepository(); @@ -158,6 +168,7 @@ public function testHideContent(): int } /** + * @param int $hiddenContentId * @return void * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException @@ -195,6 +206,16 @@ public function testRevealContent(int $hiddenContentId): void } + /** + * @return void + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ public function testUpdateContentMetadataHandler(): void { $repository = $this->getRepository(); @@ -228,7 +249,16 @@ public function testUpdateContentMetadataHandler(): void } - + /** + * @param ContentTypeService $contentTypeService + * @param string $identifier + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ private function createContentType(ContentTypeService $contentTypeService, string $identifier) { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); @@ -246,6 +276,16 @@ private function createContentType(ContentTypeService $contentTypeService, strin } + /** + * @return array + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ private function createContentForTesting() { $repository = $this->getRepository(); $contentService = $repository->getContentService(); diff --git a/tests/lib/Integration/API/DescendantIndexingLocationTest.php b/tests/lib/Integration/API/DescendantIndexingLocationTest.php index b4560fbe..b7808040 100644 --- a/tests/lib/Integration/API/DescendantIndexingLocationTest.php +++ b/tests/lib/Integration/API/DescendantIndexingLocationTest.php @@ -16,17 +16,18 @@ use Ibexa\Core\Repository\SiteAccessAware\ContentTypeService; use Ibexa\Tests\Integration\Core\Repository\BaseTest; -/** - * @group descendant-indexing - */ final class DescendantIndexingLocationTest extends BaseTest { /** * @return void + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @group assign-section-to-subtree */ public function testAssignSectionToSubtree() { @@ -74,7 +75,16 @@ public function testAssignSectionToSubtree() } - + /** + * @return void + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ public function testCopySubtree() { $repository = $this->getRepository(); @@ -116,6 +126,16 @@ public function testCopySubtree() } + /** + * @return void + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ public function testCreateLocation() { $repository = $this->getRepository(); @@ -143,6 +163,16 @@ public function testCreateLocation() self::assertEquals($parentContentFound->id, $parentLocation->contentId); } + /** + * @return void + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ public function testDeleteLocation() { $repository = $this->getRepository(); @@ -170,7 +200,16 @@ public function testDeleteLocation() self::assertEquals(0, $searchResult->totalCount); } - + /** + * @return void + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ public function testMoveSubtree() { $repository = $this->getRepository(); @@ -226,11 +265,13 @@ public function testMoveSubtree() /** * @return void - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @group swap */ public function testSwapLocation() { @@ -277,6 +318,16 @@ public function testSwapLocation() self::assertEquals(0, $searchResult->totalCount); } + /** + * @return array + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ public function testHideLocation() { $repository = $this->getRepository(); @@ -310,11 +361,12 @@ public function testHideLocation() } /** + * @param array $locations * @return void - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException + * @throws UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * * @depends testHideLocation */ @@ -353,11 +405,13 @@ public function testUnhideLocation(array $locations) /** * @return void - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @group update-location */ public function testUpdateLocation() { @@ -398,6 +452,16 @@ public function testUpdateLocation() self::assertEquals($parentLocation->contentId, $parentContentFound->contentInfo->id); } + /** + * @param ContentTypeService $contentTypeService + * @param string $identifier + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + * @throws BadStateException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ private function createContentType(ContentTypeService $contentTypeService, string $identifier) { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); @@ -416,11 +480,14 @@ private function createContentType(ContentTypeService $contentTypeService, strin } /** - * @throws ContentFieldValidationException - * @throws InvalidArgumentException + * @return array * @throws BadStateException + * @throws ContentFieldValidationException * @throws ContentValidationException + * @throws InvalidArgumentException * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ private function createLocationsForTesting() { $repository = $this->getRepository(); diff --git a/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php index b0f58e3d..594db6ec 100644 --- a/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php +++ b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php @@ -9,12 +9,16 @@ use Ibexa\Core\Repository\SiteAccessAware\ContentTypeService; use Ibexa\Tests\Integration\Core\Repository\BaseTest; -/** - * @group descendant-indexing - */ final class DescendantIndexingObjectStateTest extends BaseTest { + /** + * @return void + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ public function testSetObjectState() { $repository = $this->getRepository(); @@ -58,6 +62,14 @@ public function testSetObjectState() } + /** + * @return array + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ private function createContentForTesting() { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -95,6 +107,16 @@ private function createContentForTesting() { ]; } + /** + * @param ContentTypeService $contentTypeService + * @param string $identifier + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ private function createContentType(ContentTypeService $contentTypeService, string $identifier) { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); diff --git a/tests/lib/Integration/API/DescendantIndexingSectionTest.php b/tests/lib/Integration/API/DescendantIndexingSectionTest.php index c8bb115f..5108a6d5 100644 --- a/tests/lib/Integration/API/DescendantIndexingSectionTest.php +++ b/tests/lib/Integration/API/DescendantIndexingSectionTest.php @@ -14,12 +14,19 @@ use Ibexa\Core\Repository\SiteAccessAware\ContentTypeService; use Ibexa\Tests\Integration\Core\Repository\BaseTest; -/** - * @group descendant-indexing - */ final class DescendantIndexingSectionTest extends BaseTest { + /** + * @return void + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ public function testAssignSection() { $repository = $this->getRepository(); @@ -62,10 +69,11 @@ public function testAssignSection() /** - * @throws ContentFieldValidationException - * @throws InvalidArgumentException + * @return array * @throws BadStateException + * @throws ContentFieldValidationException * @throws ContentValidationException + * @throws InvalidArgumentException * @throws UnauthorizedException */ private function createLocationsForTesting() { @@ -115,6 +123,16 @@ private function createLocationsForTesting() { ]; } + /** + * @param ContentTypeService $contentTypeService + * @param string $identifier + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + * @throws BadStateException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ private function createContentType(ContentTypeService $contentTypeService, string $identifier) { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); From a1f0c3dc53a673c7e6ad21460dd4582902a0f073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Fri, 12 Jul 2024 14:49:22 +0200 Subject: [PATCH 60/74] NGSTACK-836 declare test return types --- .../API/DescendantIndexingContentTest.php | 8 ++++--- .../API/DescendantIndexingLocationTest.php | 24 ++++++++++--------- .../API/DescendantIndexingObjectStateTest.php | 8 ++++--- .../API/DescendantIndexingSectionTest.php | 8 ++++--- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/tests/lib/Integration/API/DescendantIndexingContentTest.php b/tests/lib/Integration/API/DescendantIndexingContentTest.php index 13075c56..61d25e48 100644 --- a/tests/lib/Integration/API/DescendantIndexingContentTest.php +++ b/tests/lib/Integration/API/DescendantIndexingContentTest.php @@ -22,7 +22,7 @@ final class DescendantIndexingContentTest extends BaseTest * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testPublishVersion() + public function testPublishVersion(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -259,7 +259,8 @@ public function testUpdateContentMetadataHandler(): void * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + private function createContentType(ContentTypeService $contentTypeService, string $identifier): \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); @@ -286,7 +287,8 @@ private function createContentType(ContentTypeService $contentTypeService, strin * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - private function createContentForTesting() { + private function createContentForTesting(): array + { $repository = $this->getRepository(); $contentService = $repository->getContentService(); $contentTypeService = $repository->getContentTypeService(); diff --git a/tests/lib/Integration/API/DescendantIndexingLocationTest.php b/tests/lib/Integration/API/DescendantIndexingLocationTest.php index b7808040..a34e01f8 100644 --- a/tests/lib/Integration/API/DescendantIndexingLocationTest.php +++ b/tests/lib/Integration/API/DescendantIndexingLocationTest.php @@ -29,7 +29,7 @@ final class DescendantIndexingLocationTest extends BaseTest * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testAssignSectionToSubtree() + public function testAssignSectionToSubtree(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -85,7 +85,7 @@ public function testAssignSectionToSubtree() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testCopySubtree() + public function testCopySubtree(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -136,7 +136,7 @@ public function testCopySubtree() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testCreateLocation() + public function testCreateLocation(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -173,7 +173,7 @@ public function testCreateLocation() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testDeleteLocation() + public function testDeleteLocation(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -210,7 +210,7 @@ public function testDeleteLocation() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testMoveSubtree() + public function testMoveSubtree(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -273,7 +273,7 @@ public function testMoveSubtree() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testSwapLocation() + public function testSwapLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -328,7 +328,7 @@ public function testSwapLocation() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testHideLocation() + public function testHideLocation(): array { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -370,7 +370,7 @@ public function testHideLocation() * * @depends testHideLocation */ - public function testUnhideLocation(array $locations) + public function testUnhideLocation(array $locations): void { $repository = $this->getRepository(false); $searchService = $repository->getSearchService(); @@ -413,7 +413,7 @@ public function testUnhideLocation(array $locations) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testUpdateLocation() + public function testUpdateLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -462,7 +462,8 @@ public function testUpdateLocation() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + private function createContentType(ContentTypeService $contentTypeService, string $identifier): \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; @@ -489,7 +490,8 @@ private function createContentType(ContentTypeService $contentTypeService, strin * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - private function createLocationsForTesting() { + private function createLocationsForTesting(): array + { $repository = $this->getRepository(); $contentService = $repository->getContentService(); $contentTypeService = $repository->getContentTypeService(); diff --git a/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php index 594db6ec..de55fd96 100644 --- a/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php +++ b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php @@ -19,7 +19,7 @@ final class DescendantIndexingObjectStateTest extends BaseTest * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testSetObjectState() + public function testSetObjectState(): void { $repository = $this->getRepository(); $contentService = $this->getRepository()->getContentService(); @@ -70,7 +70,8 @@ public function testSetObjectState() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - private function createContentForTesting() { + private function createContentForTesting(): array + { $repository = $this->getRepository(); $contentService = $repository->getContentService(); $contentTypeService = $repository->getContentTypeService(); @@ -117,7 +118,8 @@ private function createContentForTesting() { * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + private function createContentType(ContentTypeService $contentTypeService, string $identifier): \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; diff --git a/tests/lib/Integration/API/DescendantIndexingSectionTest.php b/tests/lib/Integration/API/DescendantIndexingSectionTest.php index 5108a6d5..2e9cde43 100644 --- a/tests/lib/Integration/API/DescendantIndexingSectionTest.php +++ b/tests/lib/Integration/API/DescendantIndexingSectionTest.php @@ -27,7 +27,7 @@ final class DescendantIndexingSectionTest extends BaseTest * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function testAssignSection() + public function testAssignSection(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -76,7 +76,8 @@ public function testAssignSection() * @throws InvalidArgumentException * @throws UnauthorizedException */ - private function createLocationsForTesting() { + private function createLocationsForTesting(): array + { $repository = $this->getRepository(); $contentService = $repository->getContentService(); $contentTypeService = $repository->getContentTypeService(); @@ -133,7 +134,8 @@ private function createLocationsForTesting() { * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - private function createContentType(ContentTypeService $contentTypeService, string $identifier) { + private function createContentType(ContentTypeService $contentTypeService, string $identifier): \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + { $contentTypeGroups = $contentTypeService->loadContentTypeGroups(); $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($identifier); $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; From c24a90989c606fe0eff931884be0a9cbb8bcfbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Fri, 12 Jul 2024 15:17:14 +0200 Subject: [PATCH 61/74] NGSTACK-836 remove unnecessary code --- tests/lib/Integration/API/DescendantIndexingLocationTest.php | 1 - tests/lib/Integration/API/DescendantIndexingTrashTest.php | 5 ----- 2 files changed, 6 deletions(-) diff --git a/tests/lib/Integration/API/DescendantIndexingLocationTest.php b/tests/lib/Integration/API/DescendantIndexingLocationTest.php index a34e01f8..02de0dec 100644 --- a/tests/lib/Integration/API/DescendantIndexingLocationTest.php +++ b/tests/lib/Integration/API/DescendantIndexingLocationTest.php @@ -525,7 +525,6 @@ private function createLocationsForTesting(): array $locationCreateStruct = $locationService->newLocationCreateStruct($childLocation->id); $contentCreateStruct = $contentService->newContentCreateStruct($contentType3, 'eng-GB'); $contentCreateStruct->setField('name', 'more'); - $contentCreateStruct->setField('name', 'mogorush', 'ger-DE'); $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); $grandChildContentCreated = $contentService->publishVersion($contentDraft->versionInfo); $grandChildLocation = $grandChildContentCreated->contentInfo->getMainLocation(); diff --git a/tests/lib/Integration/API/DescendantIndexingTrashTest.php b/tests/lib/Integration/API/DescendantIndexingTrashTest.php index 62c3bb79..c7e458c3 100644 --- a/tests/lib/Integration/API/DescendantIndexingTrashTest.php +++ b/tests/lib/Integration/API/DescendantIndexingTrashTest.php @@ -13,9 +13,6 @@ use Ibexa\Core\Repository\SiteAccessAware\ContentTypeService; use Ibexa\Tests\Integration\Core\Repository\BaseTest; -/** - * @group descendant-indexing - */ final class DescendantIndexingTrashTest extends BaseTest { @@ -143,8 +140,6 @@ private function createContentForTesting() { $locationCreateStruct = $locationService->newLocationCreateStruct($childLocation->id); $contentCreateStruct = $contentService->newContentCreateStruct($contentType3, 'eng-GB'); $contentCreateStruct->setField('name', 'more'); - //for testDeleteTranslation() - $contentCreateStruct->setField('name', 'mogorush', 'ger-DE'); $contentDraft = $contentService->createContent($contentCreateStruct, [$locationCreateStruct]); $grandChildContentCreated = $contentService->publishVersion($contentDraft->versionInfo); From 841c1a14dfb91dad6e54eab0ec3f6cfac1561860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Fri, 12 Jul 2024 15:29:10 +0200 Subject: [PATCH 62/74] NGSTACK-836 renaming field mappers and custom solr fields --- .../lib/Integration/API/DescendantIndexingLocationTest.php | 4 ++-- .../Integration/API/DescendantIndexingObjectStateTest.php | 2 +- tests/lib/Integration/API/DescendantIndexingSectionTest.php | 2 +- ...yFieldMapper.php => TestLocationPriorityFieldMapper.php} | 6 +++--- ...tStateFieldMapper.php => TestObjectStateFieldMapper.php} | 6 +++--- .../{SectionFieldMapper.php => TestSectionFieldMapper.php} | 6 +++--- tests/lib/Integration/Resources/config/services.yaml | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) rename tests/lib/Integration/Implementation/Solr/FieldMapper/{LocationPriorityFieldMapper.php => TestLocationPriorityFieldMapper.php} (96%) rename tests/lib/Integration/Implementation/Solr/FieldMapper/{ObjectStateFieldMapper.php => TestObjectStateFieldMapper.php} (97%) rename tests/lib/Integration/Implementation/Solr/FieldMapper/{SectionFieldMapper.php => TestSectionFieldMapper.php} (97%) diff --git a/tests/lib/Integration/API/DescendantIndexingLocationTest.php b/tests/lib/Integration/API/DescendantIndexingLocationTest.php index 02de0dec..ab88fa63 100644 --- a/tests/lib/Integration/API/DescendantIndexingLocationTest.php +++ b/tests/lib/Integration/API/DescendantIndexingLocationTest.php @@ -59,7 +59,7 @@ public function testAssignSectionToSubtree(): void 'filter' => new Query\Criterion\LogicalAnd([ new Query\Criterion\LocationId($parentLocationId), new Query\Criterion\CustomField( - 'ng_child_section_field_1_i', + 'ng_child_section_i', Operator::EQ, $mediaSectionId), new Query\Criterion\SectionId($mediaSectionId), @@ -437,7 +437,7 @@ public function testUpdateLocation(): void 'filter' => new Query\Criterion\LogicalAnd([ new Query\Criterion\LocationId($parentLocationId), new Query\Criterion\CustomField( - 'ng_child_location_priority_field_2_i', + 'ng_grandchild_location_priority_i', Operator::EQ, 3) ]), diff --git a/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php index de55fd96..e4d1fe54 100644 --- a/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php +++ b/tests/lib/Integration/API/DescendantIndexingObjectStateTest.php @@ -46,7 +46,7 @@ public function testSetObjectState(): void 'filter' => new Query\Criterion\LogicalAnd([ new Query\Criterion\LocationId($parentContent->contentInfo->mainLocationId), new Query\Criterion\CustomField( - 'ng_child_object_state_2_s', + 'ng_grandchild_object_state_s', Operator::EQ, $lockedState->identifier ) diff --git a/tests/lib/Integration/API/DescendantIndexingSectionTest.php b/tests/lib/Integration/API/DescendantIndexingSectionTest.php index 2e9cde43..b6ca334d 100644 --- a/tests/lib/Integration/API/DescendantIndexingSectionTest.php +++ b/tests/lib/Integration/API/DescendantIndexingSectionTest.php @@ -53,7 +53,7 @@ public function testAssignSection(): void 'filter' => new Query\Criterion\LogicalAnd([ new Query\Criterion\LocationId($parentLocationId), new Query\Criterion\CustomField( - 'ng_child_section_field_1_i', + 'ng_child_section_i', Operator::EQ, $mediaSectionId) ]), diff --git a/tests/lib/Integration/Implementation/Solr/FieldMapper/LocationPriorityFieldMapper.php b/tests/lib/Integration/Implementation/Solr/FieldMapper/TestLocationPriorityFieldMapper.php similarity index 96% rename from tests/lib/Integration/Implementation/Solr/FieldMapper/LocationPriorityFieldMapper.php rename to tests/lib/Integration/Implementation/Solr/FieldMapper/TestLocationPriorityFieldMapper.php index ab4db1e3..fb69b442 100644 --- a/tests/lib/Integration/Implementation/Solr/FieldMapper/LocationPriorityFieldMapper.php +++ b/tests/lib/Integration/Implementation/Solr/FieldMapper/TestLocationPriorityFieldMapper.php @@ -16,7 +16,7 @@ use Ibexa\Contracts\Core\Search\Field; use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Location\DescendantFieldMapper\BaseFieldMapper; -class LocationPriorityFieldMapper extends BaseFieldMapper +class TestLocationPriorityFieldMapper extends BaseFieldMapper { /** @@ -85,7 +85,7 @@ public function mapFields(SPILocation $location): array if (isset($childConfiguration['indexed']) && $childConfiguration['indexed'] === true) { $fieldsGrouped[] = [ new Field( - 'ng_child_location_priority_field_1', + 'ng_child_location_priority', $childLocation->priority, new IntegerField(), ), @@ -110,7 +110,7 @@ public function mapFields(SPILocation $location): array if (isset($grandChildConfiguration['indexed']) && $grandChildConfiguration['indexed'] === true) { $fieldsGrouped[] = [ new Field( - 'ng_child_location_priority_field_2', + 'ng_grandchild_location_priority', $grandChildLocation->priority, new IntegerField(), ), diff --git a/tests/lib/Integration/Implementation/Solr/FieldMapper/ObjectStateFieldMapper.php b/tests/lib/Integration/Implementation/Solr/FieldMapper/TestObjectStateFieldMapper.php similarity index 97% rename from tests/lib/Integration/Implementation/Solr/FieldMapper/ObjectStateFieldMapper.php rename to tests/lib/Integration/Implementation/Solr/FieldMapper/TestObjectStateFieldMapper.php index 325c87f2..a52d1538 100644 --- a/tests/lib/Integration/Implementation/Solr/FieldMapper/ObjectStateFieldMapper.php +++ b/tests/lib/Integration/Implementation/Solr/FieldMapper/TestObjectStateFieldMapper.php @@ -16,7 +16,7 @@ use Ibexa\Contracts\Core\Search\Field; use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper\BaseFieldMapper; -class ObjectStateFieldMapper extends BaseFieldMapper +class TestObjectStateFieldMapper extends BaseFieldMapper { /** * @var array @@ -87,7 +87,7 @@ public function mapFields(Content $content): array if (isset($childConfiguration['indexed']) && $childConfiguration['indexed'] === true) { $fieldsGrouped[] = [ new Field( - 'ng_child_object_state_1', + 'ng_child_object_state', $objectState->identifier, new StringField(), ), @@ -120,7 +120,7 @@ public function mapFields(Content $content): array if (isset($grandChildConfiguration['indexed']) && $grandChildConfiguration['indexed'] === true) { $fieldsGrouped[] = [ new Field( - 'ng_child_object_state_2', + 'ng_grandchild_object_state', $objectState->identifier, new StringField(), ), diff --git a/tests/lib/Integration/Implementation/Solr/FieldMapper/SectionFieldMapper.php b/tests/lib/Integration/Implementation/Solr/FieldMapper/TestSectionFieldMapper.php similarity index 97% rename from tests/lib/Integration/Implementation/Solr/FieldMapper/SectionFieldMapper.php rename to tests/lib/Integration/Implementation/Solr/FieldMapper/TestSectionFieldMapper.php index 89ce1ac6..07e78624 100644 --- a/tests/lib/Integration/Implementation/Solr/FieldMapper/SectionFieldMapper.php +++ b/tests/lib/Integration/Implementation/Solr/FieldMapper/TestSectionFieldMapper.php @@ -14,7 +14,7 @@ use Ibexa\Contracts\Core\Search\Field; use Netgen\IbexaSearchExtra\Core\Search\Solr\FieldMapper\Content\DescendantFieldMapper\BaseFieldMapper; -class SectionFieldMapper extends BaseFieldMapper +class TestSectionFieldMapper extends BaseFieldMapper { /** @@ -79,7 +79,7 @@ public function mapFields(Content $content): array if (isset($childConfiguration['indexed']) && $childConfiguration['indexed'] === true) { $fieldsGrouped[] = [ new Field( - 'ng_child_section_field_1', + 'ng_child_section', $contentItem->contentInfo->sectionId, new IntegerField(), ), @@ -103,7 +103,7 @@ public function mapFields(Content $content): array if (isset($grandChildConfiguration['indexed']) && $grandChildConfiguration['indexed'] === true) { $fieldsGrouped[] = [ new Field( - 'ng_child_section_field_2', + 'ng_grandchild_section', $grandChildContentItem->contentInfo->sectionId, new IntegerField(), ), diff --git a/tests/lib/Integration/Resources/config/services.yaml b/tests/lib/Integration/Resources/config/services.yaml index 2dc47e89..07b2b348 100644 --- a/tests/lib/Integration/Resources/config/services.yaml +++ b/tests/lib/Integration/Resources/config/services.yaml @@ -50,7 +50,7 @@ services: class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Stubs\RouterStub netgen.ibexa_search_extra.solr.field_mapper.location.location_priority: - class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\LocationPriorityFieldMapper + class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\TestLocationPriorityFieldMapper arguments: [ '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler', @@ -64,7 +64,7 @@ services: netgen.ibexa_search_extra.solr.field_mapper.content.section: - class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\SectionFieldMapper + class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\TestSectionFieldMapper arguments: [ '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler', @@ -76,7 +76,7 @@ services: netgen.ibexa_search_extra.solr.field_mapper.content.object_state: - class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\ObjectStateFieldMapper + class: Netgen\IbexaSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\TestObjectStateFieldMapper arguments: [ '@Ibexa\Contracts\Core\Persistence\Content\Type\Handler', From 912650ce8f7819ea21f5fa4351e35ffd2f466a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 18 Jul 2024 11:35:51 +0200 Subject: [PATCH 63/74] NGSTACK-836 fix handlers configuration --- .../DescendantIndexing/AncestorPathGenerator.php | 2 +- .../Block/DescendantFieldMapper/BaseFieldMapper.php | 2 +- .../DescendantFieldMapper/BaseFieldMapper.php | 2 +- .../Content/DescendantFieldMapper/BaseFieldMapper.php | 2 +- .../DescendantFieldMapper/BaseFieldMapper.php | 3 ++- .../Location/DescendantFieldMapper/BaseFieldMapper.php | 2 +- .../config/event_dispatcher_override_asynchronous.yaml | 10 +++++----- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorPathGenerator.php b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorPathGenerator.php index 3d8f2b99..1ddeb47b 100644 --- a/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorPathGenerator.php +++ b/lib/Core/Search/Common/Messenger/MessageHandler/Search/DescendantIndexing/AncestorPathGenerator.php @@ -127,7 +127,7 @@ private function recursiveNormalizeConfiguration(array $config): array $normalizedConfig = []; foreach ($config as $key => $value) { - if ($key === 'indexed') { + if ($key === 'indexed' || $key === 'handlers') { continue; } diff --git a/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php index b25b6dba..ed953b81 100644 --- a/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Block/DescendantFieldMapper/BaseFieldMapper.php @@ -35,7 +35,7 @@ private function internalAccept(Content $content): bool $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); $map = $this->configuration['map'] ?? []; - $handlers = $this->configuration['handlers'] ?? []; + $handlers = $map[$contentType->identifier]['handlers'] ?? []; return array_key_exists($contentType->identifier, $map) && in_array($this->getIdentifier(), $handlers, true); diff --git a/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php index 84f87e0c..cfa63079 100644 --- a/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/BlockTranslation/DescendantFieldMapper/BaseFieldMapper.php @@ -35,7 +35,7 @@ private function internalAccept(Content $content): bool $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); $map = $this->configuration['map'] ?? []; - $handlers = $this->configuration['handlers'] ?? []; + $handlers = $map[$contentType->identifier]['handlers'] ?? []; return array_key_exists($contentType->identifier, $map) && in_array($this->getIdentifier(), $handlers, true); diff --git a/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php index b48b0b82..3ea49a23 100644 --- a/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Content/DescendantFieldMapper/BaseFieldMapper.php @@ -35,7 +35,7 @@ private function internalAccept(Content $content): bool $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); $map = $this->configuration['map'] ?? []; - $handlers = $this->configuration['handlers'] ?? []; + $handlers = $map[$contentType->identifier]['handlers'] ?? []; return array_key_exists($contentType->identifier, $map) && in_array($this->getIdentifier(), $handlers, true); diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php index c578a487..48df3b33 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/DescendantFieldMapper/BaseFieldMapper.php @@ -35,7 +35,8 @@ private function internalAccept(Content $content): bool $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId); $map = $this->configuration['map'] ?? []; - $handlers = $this->configuration['handlers'] ?? []; + + $handlers = $map[$contentType->identifier]['handlers'] ?? []; return array_key_exists($contentType->identifier, $map) && in_array($this->getIdentifier(), $handlers, true); diff --git a/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php index b85932aa..2468e795 100644 --- a/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/Location/DescendantFieldMapper/BaseFieldMapper.php @@ -38,7 +38,7 @@ private function internalAccept(Location $location): bool $contentType = $this->contentTypeHandler->load($contentInfo->contentTypeId); $map = $this->configuration['map'] ?? []; - $handlers = $this->configuration['handlers'] ?? []; + $handlers = $map[$contentType->identifier]['handlers'] ?? []; return array_key_exists($contentType->identifier, $map) && in_array($this->getIdentifier(), $handlers, true); diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index e062d75a..b5514c18 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -1,13 +1,13 @@ parameters: netgen.ibexa_search_extra.descendant_indexing.configuration: enabled: true - handlers: - - ng_descendant_indexing_fulltext - - ng_descendant_indexing_location_priority - - ng_descendant_indexing_section - - ng_descendant_indexing_object_state map: descendant_indexing_test: + handlers: + - ng_descendant_indexing_fulltext + - ng_descendant_indexing_location_priority + - ng_descendant_indexing_section + - ng_descendant_indexing_object_state children: descendant_indexing_test_2: indexed: true From 3f53af9d8558496c1c7a4e662333c1ce637c7cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Tue, 30 Jul 2024 10:01:46 +0200 Subject: [PATCH 64/74] NGSTACK-836 add documentation for descendant indexing --- docs/reference/descendant_indexing.rst | 71 ++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 docs/reference/descendant_indexing.rst diff --git a/docs/reference/descendant_indexing.rst b/docs/reference/descendant_indexing.rst new file mode 100644 index 00000000..639492f8 --- /dev/null +++ b/docs/reference/descendant_indexing.rst @@ -0,0 +1,71 @@ +Descendant indexing +===================== + +This feature helps in indexing hierarchical content structures. It allows the children of a content item to be indexed +within the same document as the parent if both are configured for descendant indexing. + +''Configuration'' + +To enable this feature, set up the descendant indexing configuration: + +.. code-block:: yaml + hierarchical_indexing: + descendant_indexing: + enabled: false + map: + content_type_identifier: + handlers: + - handler_identifier_1 + - handler_identifier_2 + children: + content_type_identifier: + indexed: true + +The ``enabled`` field must be set to true to activate descendant indexing services by registering them in the container. +In the array parameter ``map`` we define the structure of content to be included in descendant indexing by content types. +Any structure in the content tree that matches the configuration will be part of descendant indexing. Content can be +part of the structure but not included in the index. To index the content in the parent document, set the ``indexed``` +parameter to ``true``. + +This feature is automatically triggered during indexing when configured correctly. + +Depending on what we want to index, we use different handlers. They represent the field mappers used to index the content. +If you want to index content to the full text fields, you should use the 'ng_descendant_indexing_fulltext' handler: + +.. code-block:: yaml + hierarchical_indexing: + descendant_indexing: + enabled: true + map: + content_type_identifier: + handlers: + - ng_descendant_indexing_fulltext + children: + content_type_identifier: + indexed: true + +To index something other than full text fields (e.g., location information or content metadata), implement new field +mappers by extending the corresponding ``BaseFieldMapper`` and registering the field mapper as a service with needed tag. +The ``getIdentifier()`` method returns a string of handler identifier which should match the handler +identifier defined in the configuration. + +.. code-block:: php + public function getIdentifier(): string + { + return 'ng_descendant_indexing_fulltext'; + } + +''AncestorIndexer'' + +AncestorIndexer is a service that ensures descendant indexing is considered during reindexing. For example, if we edit +content that is part of the descendant indexing map, the descendant content in which it is indexed should also be +reindexed. + +The service contains methods ``indexSingle()`` and ``indexMultiple()``, which are called in handlers for any content +changes (e.g., ``CopyContentHandler``, ``DeleteContentHandler``). These methods use the AncestorResolver service to +resolve the ancestor to be reindexed. If no ancestor matches the configuration map structure, the ``resolveAncestor()`` +method returns null. + +The AncestorResolver service uses AncestorPathGenerator service to read from the configuration and return an array of +strings representing all of the paths matching the given configuration in order to be able to find a match with any of +the paths. From 7fc8cf5703f5758a1167ea1bedb125c3a7be5107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Fri, 2 Aug 2024 14:07:41 +0200 Subject: [PATCH 65/74] NGSTACK-836 documentation changes --- docs/reference/descendant_indexing.rst | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/docs/reference/descendant_indexing.rst b/docs/reference/descendant_indexing.rst index 639492f8..a8295628 100644 --- a/docs/reference/descendant_indexing.rst +++ b/docs/reference/descendant_indexing.rst @@ -2,7 +2,8 @@ Descendant indexing ===================== This feature helps in indexing hierarchical content structures. It allows the children of a content item to be indexed -within the same document as the parent if both are configured for descendant indexing. +within the same document as the parent if both are configured for descendant indexing. This means that when you search +for a child content, the parent content will also appear in the search results. ''Configuration'' @@ -23,6 +24,8 @@ To enable this feature, set up the descendant indexing configuration: The ``enabled`` field must be set to true to activate descendant indexing services by registering them in the container. In the array parameter ``map`` we define the structure of content to be included in descendant indexing by content types. +The first content type identifier represents the parent content, which will hold the indexed children content document, +and the rest represent the structure under it and whether it will be indexed or not. Any structure in the content tree that matches the configuration will be part of descendant indexing. Content can be part of the structure but not included in the index. To index the content in the parent document, set the ``indexed``` parameter to ``true``. @@ -55,17 +58,5 @@ identifier defined in the configuration. return 'ng_descendant_indexing_fulltext'; } -''AncestorIndexer'' - -AncestorIndexer is a service that ensures descendant indexing is considered during reindexing. For example, if we edit -content that is part of the descendant indexing map, the descendant content in which it is indexed should also be -reindexed. - -The service contains methods ``indexSingle()`` and ``indexMultiple()``, which are called in handlers for any content -changes (e.g., ``CopyContentHandler``, ``DeleteContentHandler``). These methods use the AncestorResolver service to -resolve the ancestor to be reindexed. If no ancestor matches the configuration map structure, the ``resolveAncestor()`` -method returns null. - -The AncestorResolver service uses AncestorPathGenerator service to read from the configuration and return an array of -strings representing all of the paths matching the given configuration in order to be able to find a match with any of -the paths. +The BaseFieldMapper is implemented only for Solr indexing engine and the field mappers are plugged into the existing +solr indexing system. From f86f34e2abf428a4f68ba45b5d72fa9280b28f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Wed, 14 Aug 2024 11:34:21 +0200 Subject: [PATCH 66/74] NGSTACK-836 exclude descendant indexing from integration legacy tests --- phpunit-core-integration-legacy-solr.xml | 4 ++++ phpunit-integration-solr.xml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/phpunit-core-integration-legacy-solr.xml b/phpunit-core-integration-legacy-solr.xml index 4ffdca89..9fdd45cb 100644 --- a/phpunit-core-integration-legacy-solr.xml +++ b/phpunit-core-integration-legacy-solr.xml @@ -33,6 +33,10 @@ vendor/ibexa/core/tests/integration/Core/Repository/SearchServiceTest.php vendor/ibexa/core/tests/integration/Core/Repository/SearchServiceLocationTest.php + tests/lib/Integration/Solr/DescendantIndexingContentTest.php + tests/lib/Integration/Solr/DescendantIndexingLocationTest.php + tests/lib/Integration/Solr/DescendantIndexingObjectStateTest.php + tests/lib/Integration/Solr/DescendantIndexingTrashTest.php diff --git a/phpunit-integration-solr.xml b/phpunit-integration-solr.xml index bbb6d8e7..3dc42c6b 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -14,6 +14,10 @@ ./tests/lib/Integration/ tests/lib/Integration/API/DescendantIndexingTest.php + tests/lib/Integration/Solr/DescendantIndexingContentTest.php + tests/lib/Integration/Solr/DescendantIndexingLocationTest.php + tests/lib/Integration/Solr/DescendantIndexingObjectStateTest.php + tests/lib/Integration/Solr/DescendantIndexingTrashTest.php From 55295b90bf8836742410d68fc30efc426cb49c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Wed, 14 Aug 2024 11:42:35 +0200 Subject: [PATCH 67/74] NGSTACK-836 comment NameSchemaSubscriber line --- .../config/event_dispatcher_override_asynchronous.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index b5514c18..9f6f5bd1 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -313,4 +313,4 @@ services: - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.section']] - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.trash']] - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.user']] - - ['addSubscriber', ['@Ibexa\Core\Repository\EventSubscriber\NameSchemaSubscriber' ]] +# - ['addSubscriber', ['@Ibexa\Core\Repository\EventSubscriber\NameSchemaSubscriber' ]] From 409fe04914dbd7f076613adc11cfcc8c4202360f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Wed, 14 Aug 2024 16:47:17 +0200 Subject: [PATCH 68/74] NGSTACK-836 exclude tests fix path --- phpunit-core-integration-legacy-solr.xml | 8 ++++---- phpunit-integration-legacy.xml | 8 ++++---- phpunit-integration-solr.xml | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/phpunit-core-integration-legacy-solr.xml b/phpunit-core-integration-legacy-solr.xml index 9fdd45cb..de734512 100644 --- a/phpunit-core-integration-legacy-solr.xml +++ b/phpunit-core-integration-legacy-solr.xml @@ -33,10 +33,10 @@ vendor/ibexa/core/tests/integration/Core/Repository/SearchServiceTest.php vendor/ibexa/core/tests/integration/Core/Repository/SearchServiceLocationTest.php - tests/lib/Integration/Solr/DescendantIndexingContentTest.php - tests/lib/Integration/Solr/DescendantIndexingLocationTest.php - tests/lib/Integration/Solr/DescendantIndexingObjectStateTest.php - tests/lib/Integration/Solr/DescendantIndexingTrashTest.php + tests/lib/Integration/API/DescendantIndexingContentTest.php + tests/lib/Integration/API/DescendantIndexingLocationTest.php + tests/lib/Integration/API/DescendantIndexingObjectStateTest.php + tests/lib/Integration/API/DescendantIndexingTrashTest.php diff --git a/phpunit-integration-legacy.xml b/phpunit-integration-legacy.xml index 59e83ee6..7d332e50 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -23,10 +23,10 @@ tests/lib/Integration/API/DescendantIndexingTest.php tests/lib/Integration/Solr/RawFacetDomainTest.php tests/lib/Integration/Solr/RawFacetTest.php - tests/lib/Integration/Solr/DescendantIndexingContentTest.php - tests/lib/Integration/Solr/DescendantIndexingLocationTest.php - tests/lib/Integration/Solr/DescendantIndexingObjectStateTest.php - tests/lib/Integration/Solr/DescendantIndexingTrashTest.php + tests/lib/Integration/API/DescendantIndexingContentTest.php + tests/lib/Integration/API/DescendantIndexingLocationTest.php + tests/lib/Integration/API/DescendantIndexingObjectStateTest.php + tests/lib/Integration/API/DescendantIndexingTrashTest.php diff --git a/phpunit-integration-solr.xml b/phpunit-integration-solr.xml index 3dc42c6b..57c49bcc 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -14,10 +14,10 @@ ./tests/lib/Integration/ tests/lib/Integration/API/DescendantIndexingTest.php - tests/lib/Integration/Solr/DescendantIndexingContentTest.php - tests/lib/Integration/Solr/DescendantIndexingLocationTest.php - tests/lib/Integration/Solr/DescendantIndexingObjectStateTest.php - tests/lib/Integration/Solr/DescendantIndexingTrashTest.php + tests/lib/Integration/API/DescendantIndexingContentTest.php + tests/lib/Integration/API/DescendantIndexingLocationTest.php + tests/lib/Integration/API/DescendantIndexingObjectStateTest.php + tests/lib/Integration/API/DescendantIndexingTrashTest.php From f33b322f1ceb281ee1aa84b6428bf726b8a51a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Fri, 16 Aug 2024 13:28:51 +0200 Subject: [PATCH 69/74] NGSTACK-836 exclude DescendantIndexingSectionTest --- phpunit-core-integration-legacy-solr.xml | 1 + phpunit-integration-legacy.xml | 1 + phpunit-integration-solr.xml | 1 + 3 files changed, 3 insertions(+) diff --git a/phpunit-core-integration-legacy-solr.xml b/phpunit-core-integration-legacy-solr.xml index de734512..0e5f74fa 100644 --- a/phpunit-core-integration-legacy-solr.xml +++ b/phpunit-core-integration-legacy-solr.xml @@ -37,6 +37,7 @@ tests/lib/Integration/API/DescendantIndexingLocationTest.php tests/lib/Integration/API/DescendantIndexingObjectStateTest.php tests/lib/Integration/API/DescendantIndexingTrashTest.php + tests/lib/Integration/API/DescendantIndexingSectionTest.php diff --git a/phpunit-integration-legacy.xml b/phpunit-integration-legacy.xml index 7d332e50..b7861751 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -27,6 +27,7 @@ tests/lib/Integration/API/DescendantIndexingLocationTest.php tests/lib/Integration/API/DescendantIndexingObjectStateTest.php tests/lib/Integration/API/DescendantIndexingTrashTest.php + tests/lib/Integration/API/DescendantIndexingSectionTest.php diff --git a/phpunit-integration-solr.xml b/phpunit-integration-solr.xml index 57c49bcc..d74cad04 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -18,6 +18,7 @@ tests/lib/Integration/API/DescendantIndexingLocationTest.php tests/lib/Integration/API/DescendantIndexingObjectStateTest.php tests/lib/Integration/API/DescendantIndexingTrashTest.php + tests/lib/Integration/API/DescendantIndexingSectionTest.php From b24e1087e3a2fb880e21c715c61b89b17f578b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Tue, 10 Sep 2024 11:45:39 +0200 Subject: [PATCH 70/74] NGSTACK-836 documentation fix --- docs/reference/descendant_indexing.rst | 16 +++++++++++++--- docs/reference/index.rst | 3 ++- docs/reference/map.rst.inc | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/reference/descendant_indexing.rst b/docs/reference/descendant_indexing.rst index a8295628..517cbf41 100644 --- a/docs/reference/descendant_indexing.rst +++ b/docs/reference/descendant_indexing.rst @@ -5,11 +5,13 @@ This feature helps in indexing hierarchical content structures. It allows the ch within the same document as the parent if both are configured for descendant indexing. This means that when you search for a child content, the parent content will also appear in the search results. -''Configuration'' +Configuration +-------------- To enable this feature, set up the descendant indexing configuration: .. code-block:: yaml + hierarchical_indexing: descendant_indexing: enabled: false @@ -36,6 +38,7 @@ Depending on what we want to index, we use different handlers. They represent th If you want to index content to the full text fields, you should use the 'ng_descendant_indexing_fulltext' handler: .. code-block:: yaml + hierarchical_indexing: descendant_indexing: enabled: true @@ -47,16 +50,23 @@ If you want to index content to the full text fields, you should use the 'ng_des content_type_identifier: indexed: true + + To index something other than full text fields (e.g., location information or content metadata), implement new field mappers by extending the corresponding ``BaseFieldMapper`` and registering the field mapper as a service with needed tag. The ``getIdentifier()`` method returns a string of handler identifier which should match the handler identifier defined in the configuration. .. code-block:: php + public function getIdentifier(): string { return 'ng_descendant_indexing_fulltext'; } -The BaseFieldMapper is implemented only for Solr indexing engine and the field mappers are plugged into the existing -solr indexing system. + +.. note:: + + The BaseFieldMapper is implemented only for Solr indexing engine and the field mappers are plugged into the existing + solr indexing system. + diff --git a/docs/reference/index.rst b/docs/reference/index.rst index c378161e..26720b5b 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -10,9 +10,10 @@ Reference subdocuments spellcheck_suggestions extra_fields - asynchronous_indexing document_factory fulltext_search_boosting page_indexing + asynchronous_indexing + descendant_indexing .. include:: /reference/map.rst.inc diff --git a/docs/reference/map.rst.inc b/docs/reference/map.rst.inc index c5ba3c8f..e37a6a73 100644 --- a/docs/reference/map.rst.inc +++ b/docs/reference/map.rst.inc @@ -7,3 +7,4 @@ * :doc:`/reference/document_factory` * :doc:`/reference/fulltext_search_boosting` * :doc:`/reference/page_indexing` +* :doc:`/reference/descendant_indexing` From a5bf81459f219522421c2cb3461aac71c2692aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 10 Jun 2025 11:39:29 +0200 Subject: [PATCH 71/74] NGSTACK-836: define schemas for ContentType --- tests/lib/Integration/API/DescendantIndexingLocationTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/lib/Integration/API/DescendantIndexingLocationTest.php b/tests/lib/Integration/API/DescendantIndexingLocationTest.php index ab88fa63..a06bcee3 100644 --- a/tests/lib/Integration/API/DescendantIndexingLocationTest.php +++ b/tests/lib/Integration/API/DescendantIndexingLocationTest.php @@ -469,6 +469,8 @@ private function createContentType(ContentTypeService $contentTypeService, strin $contentTypeCreateStruct->mainLanguageCode = 'eng-GB'; $contentTypeCreateStruct->names = ['eng-GB' => 'Descendant indexing test']; $contentTypeCreateStruct->isContainer = true; + $contentTypeCreateStruct->nameSchema = ''; + $contentTypeCreateStruct->urlAliasSchema = ''; $fieldDefinitionCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('name', 'ezstring'); $fieldDefinitionCreateStruct->position = 0; $fieldDefinitionCreateStruct->isSearchable = true; From a51ce07cb43d24fb981421d56b41906a163e4731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 10 Jun 2025 12:19:28 +0200 Subject: [PATCH 72/74] NGSTACK-836: add missing event subscribers --- .../Resources/config/event_dispatcher_override.yaml | 4 +++- .../config/event_dispatcher_override_asynchronous.yaml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override.yaml index 71303707..e411aa06 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override.yaml @@ -8,4 +8,6 @@ services: - ['addSubscriber', ['@Ibexa\Core\Search\Common\EventSubscriber\SectionEventSubscriber']] - ['addSubscriber', ['@Ibexa\Core\Search\Common\EventSubscriber\TrashEventSubscriber']] - ['addSubscriber', ['@Ibexa\Core\Search\Common\EventSubscriber\UserEventSubscriber']] - - ['addSubscriber', ['@Ibexa\Core\Repository\EventSubscriber\NameSchemaSubscriber' ]] + - ['addSubscriber', ['@Ibexa\Core\Search\Common\EventSubscriber\BookmarkEventSubscriber']] + - ['addSubscriber', ['@Ibexa\Core\Repository\EventSubscriber\NameSchemaSubscriber']] + - ['addSubscriber', ['@Ibexa\Core\Persistence\Legacy\Content\Mapper\ResolveVirtualFieldSubscriber']] diff --git a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml index 9f6f5bd1..6771b3f4 100644 --- a/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml +++ b/tests/lib/Integration/Resources/config/event_dispatcher_override_asynchronous.yaml @@ -313,4 +313,6 @@ services: - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.section']] - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.trash']] - ['addSubscriber', ['@netgen_test.ibexa_search_extra.asynchronous_indexing.event_subscriber.user']] -# - ['addSubscriber', ['@Ibexa\Core\Repository\EventSubscriber\NameSchemaSubscriber' ]] + - ['addSubscriber', ['@Ibexa\Core\Search\Common\EventSubscriber\BookmarkEventSubscriber']] + - ['addSubscriber', ['@Ibexa\Core\Repository\EventSubscriber\NameSchemaSubscriber']] + - ['addSubscriber', ['@Ibexa\Core\Persistence\Legacy\Content\Mapper\ResolveVirtualFieldSubscriber']] From 1b3a6a807ff01218f785736c7ce9598560a8e4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 10 Jun 2025 13:30:52 +0200 Subject: [PATCH 73/74] NGSTACK-836: fix language --- phpunit-core-integration-legacy-solr-asynchronous.xml | 2 +- phpunit-core-integration-legacy-solr.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit-core-integration-legacy-solr-asynchronous.xml b/phpunit-core-integration-legacy-solr-asynchronous.xml index 387e6437..14bc1179 100644 --- a/phpunit-core-integration-legacy-solr-asynchronous.xml +++ b/phpunit-core-integration-legacy-solr-asynchronous.xml @@ -25,7 +25,7 @@ - + tests/lib/Kernel vendor/ibexa/core/tests/integration/Core diff --git a/phpunit-core-integration-legacy-solr.xml b/phpunit-core-integration-legacy-solr.xml index 0e5f74fa..fe42c9a9 100644 --- a/phpunit-core-integration-legacy-solr.xml +++ b/phpunit-core-integration-legacy-solr.xml @@ -25,7 +25,7 @@ - + tests/lib/Kernel vendor/ibexa/core/tests/integration/Core From 6b93f4f46b72fd1207d38ed3b36e8da979631f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Tue, 10 Jun 2025 13:31:06 +0200 Subject: [PATCH 74/74] NGSTACK-836: add missing compiler pass --- .../lib/Integration/SetupFactory/RegressionSolrAsynchronous.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php b/tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php index 03107fa1..00eb47db 100644 --- a/tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php +++ b/tests/lib/Integration/SetupFactory/RegressionSolrAsynchronous.php @@ -39,5 +39,6 @@ protected function externalBuildContainer(ContainerBuilder $containerBuilder): v $containerBuilder->addCompilerPass(new Compiler\AggregateFacetBuilderVisitorPass()); $containerBuilder->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass()); $containerBuilder->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass()); + $containerBuilder->addCompilerPass(new Compiler\ElasticsearchExtensibleDocumentFactoryPass()); } }