From 385c9b823a8f4366b11dfe45de573feb888aa07a 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/70] NGSTACK-836 parent child indexer --- bundle/DependencyInjection/Configuration.php | 13 + .../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, 1691 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 ce69b341..d369b9f3 100644 --- a/bundle/DependencyInjection/Configuration.php +++ b/bundle/DependencyInjection/Configuration.php @@ -25,6 +25,8 @@ public function getConfigTreeBuilder(): TreeBuilder $this->addIndexableFieldTypeSection($rootNode); $this->addSearchResultExtractorSection($rootNode); $this->addAsynchronousIndexingSection($rootNode); + $this->addParentChildIndexingSection($rootNode); + return $treeBuilder; } @@ -73,4 +75,15 @@ private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinit ->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 f8c994e9..9f0355cf 100644 --- a/lib/Resources/config/search/common.yaml +++ b/lib/Resources/config/search/common.yaml @@ -1,3 +1,4 @@ imports: - { resource: common/asynchronous_indexing.yaml } - { resource: common/field_value_mappers.yaml } + - { resource: common/parent_child_indexing.yaml } 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 7b8253231fe7efca87c3eff9b1c0c78e614f9965 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/70] 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 a3b6d7593779e076fc931573b815481e22648297 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/70] 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 34cab02d2671f8c3466ede8dfd48a5b39fb76285 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/70] 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 729acae5..f53bec23 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -88,6 +88,7 @@ private function processExtensionConfiguration(array $configs, ContainerBuilder $this->processIndexableFieldTypeConfiguration($configuration, $container); $this->processSearchResultExtractorConfiguration($configuration, $container); $this->processAsynchronousIndexingConfiguration($configuration, $container); + $this->processParentChildIndexingConfiguration($configuration, $container); } private function processSearchResultExtractorConfiguration(array $configuration, ContainerBuilder $container): void @@ -117,4 +118,12 @@ private function processAsynchronousIndexingConfiguration(array $configuration, $configuration['use_asynchronous_indexing'], ); } + + 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 eb3dbec3..44202adc 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 9e9162aec6ef5050fdb7e3e63e97867babd3e6a5 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/70] 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 0709a0dd9d0d9cf072ad9b478557b00b0c64f529 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/70] 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 603e375afb3443b353c9c994618583abd508387b 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/70] 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 89fff6d112c39be95f734133ba80a06b465e0c49 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/70] 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 1efebab294d3d87d95b37ac6485a90325ef3aca4 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/70] 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 2b6c310f919017c87afdce5d4f298e4ce29f31d5 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/70] 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 092ecae761c989eb263c54c1e718c0dfa062ddec 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/70] 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 0cd39130b2429d86460349454e609f4ffa49f113 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/70] 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 de8d585a0ed94cf9acef2a2ef50d8ef9bf1b31bd 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/70] 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 181851a42a0fb3ecdaba1c8ee860328823dd52d3 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/70] 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 1c560c14c5b4299642d3c4c104eb7be45da06dd9 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/70] 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 02f3088f408ffcf87cd2da2974b40adcb18eb7b4 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/70] 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/70] 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 96531ac78502ab214f8b15569e17b38fd2d1db05 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/70] 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 d4cf4e039da8604abdf3aa33a10319cb72145d41 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/70] 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 d4aa014499ad1a9496f12b2fac45cf961813f13e 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/70] 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 0f792ad7d65ee11b86640576ba692987956d5211 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/70] 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 0201bf040cf43b692752b52b6ba50b9f4b4be3f1 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/70] 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 a2d5383bd88fd27264310b60eafee7e360d756bc 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/70] 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 f5f2026b20c041e3183c5779def26eafc58fb80f 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/70] 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 c62c84eafed401c46ac3d3e6009816df51d4d217 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/70] 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 aa89585e2f3a2c629a1899a108f03146549d8d93 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/70] 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 e18ecc5a230d8ffbd8a1e00690bd50546dc9ec9d 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/70] 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 98f8c522..fb7f47a6 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-latest 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 82bb0d28..95c563e9 100644 --- a/tests/lib/Integration/Resources/config/services.yaml +++ b/tests/lib/Integration/Resources/config/services.yaml @@ -49,50 +49,3 @@ services: - '@Ibexa\Core\Search\Legacy\Content\Handler' 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' diff --git a/tests/lib/Integration/SetupFactory/RegressionSolr.php b/tests/lib/Integration/SetupFactory/RegressionSolr.php index 132fde20..5ee28e6e 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 965810be9f1adce217fb6ce3eb3c3fa64f53c502 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/70] 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 1aeaef6b5dad932be003f4a142ec05dae024351d 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/70] 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 95b538392e15227c16752e20a791c645d1f6315b 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/70] 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 af508f9be17b2a4df50633d32a1e577859bde42b 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/70] 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 33defd257285cbde1fd1796640748c9d795b0180 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/70] 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 043c4edd50e5847220d81421fd2d9c98672dbddf 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/70] 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 2cb105e41c0f292b7061c130916797c86f70325d 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/70] 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 e22ccd6b870c88be3cccb8e4bbd40b0d8f30e71c 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/70] 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 315a1ab5db9d35055ef258a12d5f3c5fd0670e65 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/70] 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 c3f6028022ebcf7eb446c1743ae212d43817f75a 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/70] 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 f0e54c5e5a7d1cae2bc1b757286ee101b6d0992b 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/70] 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 d369b9f3..826cb455 100644 --- a/bundle/DependencyInjection/Configuration.php +++ b/bundle/DependencyInjection/Configuration.php @@ -81,7 +81,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 f53bec23..bbd3cd27 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -125,5 +125,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 3fbf1f99e910e1b3865d8fc36f645f3a5098cd8c 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/70] NGSTACK-836: implement recursive semantic config --- bundle/DependencyInjection/Configuration.php | 117 +++- .../NetgenIbexaSearchExtraExtensionTest.php | 607 ++++++++++++++++++ 2 files changed, 718 insertions(+), 6 deletions(-) diff --git a/bundle/DependencyInjection/Configuration.php b/bundle/DependencyInjection/Configuration.php index 826cb455..efef0f5b 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; class Configuration implements ConfigurationInterface { @@ -26,7 +27,7 @@ public function getConfigTreeBuilder(): TreeBuilder $this->addSearchResultExtractorSection($rootNode); $this->addAsynchronousIndexingSection($rootNode); $this->addParentChildIndexingSection($rootNode); - + $this->addHierarchicalIndexingSection($rootNode); return $treeBuilder; } @@ -47,7 +48,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() @@ -62,7 +63,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 @@ -73,7 +74,7 @@ private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinit ->info('Use asynchronous mechanism to handle repository content indexing') ->defaultFalse() ->end() - ->end(); + ?->end(); } private function addParentChildIndexingSection(ArrayNodeDefinition $nodeDefinition): void @@ -84,10 +85,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 f1a23998..8a3742cb 100644 --- a/tests/bundle/DependencyInjection/NetgenIbexaSearchExtraExtensionTest.php +++ b/tests/bundle/DependencyInjection/NetgenIbexaSearchExtraExtensionTest.php @@ -6,6 +6,7 @@ use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Netgen\Bundle\IbexaSearchExtraBundle\DependencyInjection\NetgenIbexaSearchExtraExtension; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; @@ -91,6 +92,612 @@ public function testIndexableFieldTypeDefaultConfiguration(array $configuration) ); } + 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 12926a381056bae2cbd322083348d3d1251fb43d 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/70] 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 8a1f388395da012eee9f0c14303494d784639f96 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/70] 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 ce837316e379e7a5bafe4ee2c3afd6f59a692d70 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/70] 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 55f27af6f716f7fbdb701096db61335a1505c271 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/70] 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 05f63535e1db8c8cf45b4d4dda892c6afa192e97 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/70] 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 7236f8c5..952b69cc 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -18,6 +18,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 65719810..8d0a30ae 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -18,6 +18,7 @@ ./bundle ./lib + tests/lib/Integration/API/ParentChildIndexingTest.php From 1dcb5d0ea1e5f71be88400d6d25ece1be2fcbd70 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/70] 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 8d0a30ae..2261b713 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -12,13 +12,13 @@ ./tests/lib/Integration/ + tests/lib/Integration/API/ParentChildIndexingTest.php ./bundle ./lib - tests/lib/Integration/API/ParentChildIndexingTest.php From 3662e72f3741e41d3fa9c5ee5989f584efaa01ac 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/70] 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 d6bc30c1ae80514379d067a560e594078a029495 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/70] 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 0ab45f70a92c91a58401f2291e408ee87ee698aa 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/70] 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 189ed5c47bb8c42ec3165b70944468a92a8125da 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/70] NGSTACK-836: implement configurable Solr field handlers for descendant indexing --- bundle/DependencyInjection/Configuration.php | 16 ----- .../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 +++++++++++-------- 20 files changed, 507 insertions(+), 171 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/Configuration.php b/bundle/DependencyInjection/Configuration.php index efef0f5b..f8174832 100644 --- a/bundle/DependencyInjection/Configuration.php +++ b/bundle/DependencyInjection/Configuration.php @@ -26,7 +26,6 @@ public function getConfigTreeBuilder(): TreeBuilder $this->addIndexableFieldTypeSection($rootNode); $this->addSearchResultExtractorSection($rootNode); $this->addAsynchronousIndexingSection($rootNode); - $this->addParentChildIndexingSection($rootNode); $this->addHierarchicalIndexingSection($rootNode); return $treeBuilder; @@ -77,21 +76,6 @@ private function addAsynchronousIndexingSection(ArrayNodeDefinition $nodeDefinit ?->end(); } - private function addParentChildIndexingSection(ArrayNodeDefinition $nodeDefinition): void - { - $nodeDefinition - ->children() - ->booleanNode('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(); - } - private function addHierarchicalIndexingSection(ArrayNodeDefinition $nodeDefinition): void { $childrenNodeDefinition = $nodeDefinition diff --git a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php index bbd3cd27..f9bf4dc3 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -122,13 +122,8 @@ private function processAsynchronousIndexingConfiguration(array $configuration, 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 627744e0..e927ddd9 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 f227bf0a5ef02cbac755f118b285c2d78ed8fc47 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/70] 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 f9bf4dc3..36496496 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -122,7 +122,7 @@ private function processAsynchronousIndexingConfiguration(array $configuration, 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 44202adc..a283469a 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 9f0355cf..656f8403 100644 --- a/lib/Resources/config/search/common.yaml +++ b/lib/Resources/config/search/common.yaml @@ -1,4 +1,4 @@ imports: - { resource: common/asynchronous_indexing.yaml } - { resource: common/field_value_mappers.yaml } - - { resource: common/parent_child_indexing.yaml } + - { resource: common/descendant_indexing.yaml } 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 e927ddd9..e77a1b49 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 952b69cc..5a714aef 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -18,7 +18,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 2261b713..37b56a26 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -12,7 +12,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 a6d6aee2f1dc6978a704da35acffd8b230826019 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/70] 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 36496496..f13c81a4 100644 --- a/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php +++ b/bundle/DependencyInjection/NetgenIbexaSearchExtraExtension.php @@ -88,7 +88,7 @@ private function processExtensionConfiguration(array $configs, ContainerBuilder $this->processIndexableFieldTypeConfiguration($configuration, $container); $this->processSearchResultExtractorConfiguration($configuration, $container); $this->processAsynchronousIndexingConfiguration($configuration, $container); - $this->processParentChildIndexingConfiguration($configuration, $container); + $this->processDescendantIndexingConfiguration($configuration, $container); } private function processSearchResultExtractorConfiguration(array $configuration, ContainerBuilder $container): void @@ -119,7 +119,7 @@ private function processAsynchronousIndexingConfiguration(array $configuration, ); } - 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 ad5476cee6dd095a970f9209c5791fdc22552998 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/70] 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 2fe6d6dfb44575f4bfe958fc74bbb4ea76935258 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/70] 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 abc846b292474b4ae48b3c3aa0e77d6d863c3a66 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/70] 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 84d443d187dfaa59b2d8532b54841a239ab0d793 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/70] 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 95c563e9..ef47c5a4 100644 --- a/tests/lib/Integration/Resources/config/services.yaml +++ b/tests/lib/Integration/Resources/config/services.yaml @@ -49,3 +49,41 @@ services: - '@Ibexa\Core\Search\Legacy\Content\Handler' tags: - { name: ibexa.search.solr.field.mapper.location } + + 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 0a195c3dcc64704224edfb5bb20f275111c82651 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/70] 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 11f18a5db3fa75fadfda1dc1d6b959f8b6202c3c 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/70] 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 dea79ff4c1323bf740e751ec69d715c6df2a8dbb 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/70] 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 5a714aef..a6f488e1 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -21,6 +21,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 f95b258d654db0ff518d81bcf46706567ac8bae2 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/70] 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 eb2cecb8aeb842513e519ae3d5a227c6abf124f7 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/70] 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 c5b7c37978fbc08fa28d165e25dd800ec5d5e87a 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/70] 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 5dcb6adeb13997f1d2470ae86a6e6aef35291b29 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/70] 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 ef47c5a4..e68d6a01 100644 --- a/tests/lib/Integration/Resources/config/services.yaml +++ b/tests/lib/Integration/Resources/config/services.yaml @@ -51,7 +51,7 @@ services: - { name: ibexa.search.solr.field.mapper.location } 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', @@ -65,7 +65,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', @@ -77,7 +77,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 85179645d6210ab8fb903ea59a353a90bd69f981 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/70] 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 113a696ca07a4a90e2e222741d739628cb1dc66c 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/70] 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 9014f2e90e3b61cb5bdd26e9a7034840b21ee0cc 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/70] 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 d0481059afe8a43ecda55d824759b697d1dc80c9 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/70] 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 ef2a2a1a..f6956c7d 100644 --- a/phpunit-core-integration-legacy-solr.xml +++ b/phpunit-core-integration-legacy-solr.xml @@ -31,6 +31,10 @@ 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/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 37b56a26..512729ca 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -13,6 +13,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 720d6334ce5d8b37277068b6b2ad7f61719adadb 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/70] 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 a457c119eab3af3bdcb3a358aee18171fa129438 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/70] 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 f6956c7d..3b20da37 100644 --- a/phpunit-core-integration-legacy-solr.xml +++ b/phpunit-core-integration-legacy-solr.xml @@ -31,10 +31,10 @@ 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/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 a6f488e1..83835ca4 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -21,10 +21,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 512729ca..0aa086bc 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -13,10 +13,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 0d1f267548dbae7d54c6d2364e782c76a49b9c25 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/70] 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 3b20da37..06a68d0f 100644 --- a/phpunit-core-integration-legacy-solr.xml +++ b/phpunit-core-integration-legacy-solr.xml @@ -35,6 +35,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 83835ca4..41394d55 100644 --- a/phpunit-integration-legacy.xml +++ b/phpunit-integration-legacy.xml @@ -25,6 +25,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 0aa086bc..424b60b6 100644 --- a/phpunit-integration-solr.xml +++ b/phpunit-integration-solr.xml @@ -17,6 +17,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 e3264c0e03ceb0c9f50b1a7a3a95924b62b971af 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/70] NGSTACK-836 documentation fix --- docs/reference/descendant_indexing.rst | 16 +++++++++++++--- docs/reference/index.rst | 2 ++ docs/reference/map.rst.inc | 1 + 3 files changed, 16 insertions(+), 3 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 996318ee..514c1e94 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -9,5 +9,7 @@ Reference subdocuments spellcheck_suggestions extra_fields + asynchronous_indexing + descendant_indexing .. include:: /reference/map.rst.inc diff --git a/docs/reference/map.rst.inc b/docs/reference/map.rst.inc index 626ee8e9..178c9395 100644 --- a/docs/reference/map.rst.inc +++ b/docs/reference/map.rst.inc @@ -4,3 +4,4 @@ * :doc:`/reference/subdocuments` * :doc:`/reference/spellcheck_suggestions` * :doc:`/reference/extra_fields` +* :doc:`/reference/descendant_indexing`