From bfb4a6b021181ef67be23fee9db99ebb1d41723a Mon Sep 17 00:00:00 2001 From: lukmzig <30526586+lukmzig@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:48:15 +0100 Subject: [PATCH] [WIP] Add support for elasticsearch and openSearch (#239) * feat: add first implementation of common search adapter * Apply php-cs-fixer changes * update dependencies * Update src/DependencyInjection/PimcoreGenericDataIndexExtension.php Co-authored-by: Jacob Dreesen * add some more cleanup * fix: sonar * Apply php-cs-fixer changes * update tests * Apply php-cs-fixer changes * update tests * update tests * update tests * update tests * Apply php-cs-fixer changes * update tests * re-enable all tests * split workflows * update test method names * update test workflow names * fix: re-enable tests * [WIP] Add support for elasticsearch and openSearch - docs and namespaces (#254) * add new namespaces and update docs * rename and deprecate opensearch namespaces and adapt the docs * remove error * fix some sonar issues * fix some sonar issues * fix docs typo * Apply php-cs-fixer changes * fix STAN * fix aliases * fix ignore some STAN errors * fix ignore some STAN errors --------- Co-authored-by: lukmzig Co-authored-by: Jacob Dreesen --- .../ci/files/config/packages/test/config.yaml | 9 + .github/ci/files/config/services_test.yaml | 2 +- ...up-pimcore-environment-functional-tests.sh | 6 + .../workflows/elastic-search-codeception.yaml | 119 ++++++++ ...tion.yaml => open-search-codeception.yaml} | 10 +- README.md | 8 +- composer.json | 10 +- .../{open-search.yaml => default-search.yaml} | 66 ++--- .../modifiers/modifier-service.yaml | 2 +- .../modifiers/search-modifiers.yaml | 24 ++ .../pql-field-name-transformers.yaml | 16 +- .../modifiers/search-modifiers.yaml | 24 -- .../asset/field-definition-adapters.yaml | 10 +- .../search/asset/mapping-provider.yaml | 2 +- .../data-object/field-definition-adapters.yml | 62 ++-- config/services/search/index.yaml | 4 +- doc/01_Installation/README.md | 6 +- doc/02_Configuration/05_Elasticsearch.md | 35 +++ doc/02_Configuration/README.md | 5 +- .../05_Search_Modifiers/README.md | 58 ++-- .../README.md | 42 ++- .../03_Use_PQL_as_Developer.md | 2 +- .../09_Pimcore_Query_Language/README.md | 7 +- doc/04_Searching_For_Data_In_Index/README.md | 16 +- .../06_Extend_Search_Index.md | 10 +- phpstan.neon | 2 + sonar-project.properties | 3 +- .../OpenSearch/AsSearchModifierHandler.php | 4 + .../Search/AsSearchModifierHandler.php | 24 ++ .../Compiler/SearchModifierHandlerPass.php | 2 +- .../Compiler/ServiceLocatorPass.php | 4 +- src/DependencyInjection/Configuration.php | 8 +- .../PimcoreGenericDataIndexExtension.php | 30 +- src/Enum/SearchIndex/ClientType.php | 26 ++ .../DefaultSearch/AttributeType.php | 32 ++ .../DefaultSearch/ConditionType.php | 26 ++ .../SearchIndex/DefaultSearch/QueryType.php | 23 ++ .../DefaultSearch/WildcardFilterMode.php | 25 ++ .../SearchIndex/OpenSearch/AttributeType.php | 4 +- .../SearchIndex/OpenSearch/ConditionType.php | 3 +- src/Enum/SearchIndex/OpenSearch/QueryType.php | 4 + .../OpenSearch/WildcardFilterMode.php | 4 + src/EventSubscriber/DebugSubscriber.php | 10 +- .../ResultWindowTooLargeException.php | 4 +- .../DefaultSearch/SearchFailedException.php | 39 +++ .../OpenSearch/SearchFailedException.php | 4 + .../DefaultSearch/Aggregation/Aggregation.php | 36 +++ .../Aggregation/AggregationList.php | 51 ++++ .../DefaultSearch/Debug/SearchInformation.php | 83 ++++++ .../DefaultSearch/DefaultSearchInterface.php | 45 +++ .../Modifier/SearchModifierContext.php | 39 +++ .../SearchModifierContextInterface.php | 33 +++ .../Query/AsSubQueryInterface.php | 22 ++ src/Model/DefaultSearch/Query/BoolQuery.php | 83 ++++++ src/Model/DefaultSearch/Query/DateFilter.php | 187 ++++++++++++ src/Model/DefaultSearch/Query/Query.php | 54 ++++ .../DefaultSearch/Query/QueryInterface.php | 30 ++ src/Model/DefaultSearch/Query/QueryList.php | 88 ++++++ .../Query/SimpleQueryStringFilter.php | 48 +++ src/Model/DefaultSearch/Query/TermFilter.php | 54 ++++ src/Model/DefaultSearch/Query/TermsFilter.php | 56 ++++ .../DefaultSearch/Query/WildcardFilter.php | 78 +++++ src/Model/DefaultSearch/Search.php | 171 +++++++++++ src/Model/DefaultSearch/Sort/FieldSort.php | 78 +++++ .../DefaultSearch/Sort/FieldSortList.php | 56 ++++ .../Traits/QueryObjectsToArrayTrait.php | 39 +++ .../Traits/SimplifySingleTypesTrait.php | 31 ++ .../OpenSearch/Aggregation/Aggregation.php | 4 + .../Aggregation/AggregationList.php | 4 + .../OpenSearch/Debug/SearchInformation.php | 8 +- .../Modifier/SearchModifierContext.php | 4 + .../SearchModifierContextInterface.php | 4 + .../OpenSearch/OpenSearchSearchInterface.php | 5 +- .../OpenSearch/Query/AsSubQueryInterface.php | 4 + src/Model/OpenSearch/Query/BoolQuery.php | 4 + src/Model/OpenSearch/Query/DateFilter.php | 4 + src/Model/OpenSearch/Query/Query.php | 4 + src/Model/OpenSearch/Query/QueryInterface.php | 4 + src/Model/OpenSearch/Query/QueryList.php | 4 + .../Query/SimpleQueryStringFilter.php | 4 + src/Model/OpenSearch/Query/TermFilter.php | 4 + src/Model/OpenSearch/Query/TermsFilter.php | 4 + src/Model/OpenSearch/Query/WildcardFilter.php | 4 + src/Model/OpenSearch/Search.php | 8 +- src/Model/OpenSearch/Sort/FieldSort.php | 4 + src/Model/OpenSearch/Sort/FieldSortList.php | 4 + .../Traits/QueryObjectsToArrayTrait.php | 4 + .../Traits/SimplifySingleTypesTrait.php | 4 + .../Interfaces/AdapterSearchInterface.php | 7 +- src/PimcoreGenericDataIndexBundle.php | 39 ++- .../Asset/AdapterInterface.php | 2 +- .../AbstractAdapter.php | 144 +++++++++ .../FieldDefinitionAdapter/BooleanAdapter.php | 4 +- .../FieldDefinitionAdapter/DateAdapter.php | 6 +- .../FieldDefinitionAdapter/KeywordAdapter.php | 6 +- .../RelationAdapter.php | 4 +- .../TextKeywordAdapter.php | 4 +- .../Asset/FieldDefinitionService.php | 2 +- .../Asset/PredefinedAssetMetadataProvider.php | 2 +- .../BulkOperationService.php | 13 +- .../AbstractAdapter.php | 67 +++++ .../AdvancedImageAdapter.php | 4 +- .../AdvancedManyToManyRelationAdapter.php | 15 +- .../FieldDefinitionAdapter/BlockAdapter.php | 2 +- .../FieldDefinitionAdapter/BooleanAdapter.php | 4 +- .../ClassificationStoreAdapter.php | 4 +- .../FieldDefinitionAdapter/ConsentAdapter.php | 4 +- .../FieldDefinitionAdapter/DateAdapter.php | 4 +- .../DateRangeAdapter.php | 4 +- .../DatetimeAdapter.php | 4 +- .../ExternalImageAdapter.php | 4 +- .../FieldCollectionAdapter.php | 4 +- .../GeographicBoundsAdapter.php | 2 +- .../GeographicPointAdapter.php | 2 +- .../HasLatitudeAnfLongitudeTrait.php | 4 +- .../FieldDefinitionAdapter/ImageAdapter.php | 4 +- .../ImageGalleryAdapter.php | 4 +- .../InputQuantityValueAdapter.php | 4 +- .../FieldDefinitionAdapter/LinkAdapter.php | 4 +- .../LocalizedFieldsAdapter.php | 2 +- .../FieldDefinitionAdapter/NumericAdapter.php | 4 +- .../NumericRangeAdapter.php | 4 +- .../ObjectBrickAdapter.php | 2 +- .../QuantityValueAdapter.php | 4 +- .../QuantityValueRangeAdapter.php | 4 +- .../RelationAdapter.php | 4 +- .../RgbaColorAdapter.php | 4 +- .../StructuredTableAdapter.php | 4 +- .../FieldDefinitionAdapter/TableAdapter.php | 2 +- .../TextKeywordAdapter.php | 2 +- .../FieldDefinitionAdapter/TimeAdapter.php | 4 +- .../FieldDefinitionAdapter/UrlSlugAdapter.php | 4 +- .../FieldDefinitionAdapter/VideoAdapter.php | 4 +- .../DataObject/FieldDefinitionService.php | 2 +- .../DataObject/IndexIconUpdateService.php | 8 +- .../DefaultSearchService.php} | 75 +++-- .../IndexAliasService.php | 17 +- .../IndexMappingService.php | 16 +- .../IndexStatsService.php | 12 +- .../MappingAnalyzerService.php | 2 +- .../MappingAnalyzerServiceInterface.php | 2 +- .../PathService.php | 12 +- ...ssetMetadataDefaultLanguageTransformer.php | 6 +- .../FieldCategoryTransformer.php | 6 +- .../FieldNameTransformer/IdTransformer.php | 6 +- .../ImageGalleryTransformer.php | 6 +- .../KeywordTransformer.php | 6 +- .../RelationsTransformer.php | 6 +- .../FieldNameTransformer/SortTransformer.php | 6 +- .../SynonymTransformer.php | 4 +- .../FieldNameTransformerInterface.php | 2 +- .../FieldExistsValidator.php | 6 +- .../LocalizedFieldValidator.php | 6 +- .../FieldNameValidator/RelationValidator.php | 6 +- .../FieldNameValidatorInterface.php | 4 +- .../QueryLanguage/PqlAdapter.php | 2 +- .../QueryLanguage/SubQueriesProcessor.php | 10 +- .../SubQueriesProcessorInterface.php | 2 +- .../Search/FetchIdsBySearchService.php | 12 +- .../FetchIdsBySearchServiceInterface.php | 6 +- .../Search/FetchIdsService.php | 12 +- .../Search/LocateInTreeService.php | 28 +- .../Aggregation/AssetAggregations.php | 8 +- .../Modifier/Aggregation/TreeAggregations.php | 10 +- .../Search/Modifier/Filter/AssetFilters.php | 6 +- .../Search/Modifier/Filter/BasicFilters.php | 12 +- .../Modifier/Filter/DependencyFilters.php | 14 +- .../Modifier/Filter/FieldTypeFilters.php | 8 +- .../Search/Modifier/Filter/TreeFilters.php | 12 +- .../Workspace/WorkspaceQueryHandler.php | 6 +- .../FullTextSearch/FullTextSearchHandlers.php | 12 +- .../QueryLanguage/QueryLanguageHandlers.php | 10 +- .../Search/Modifier/SearchModifierService.php | 8 +- .../Modifier/Sort/OrderByFieldsHandlers.php | 8 +- .../Search/Modifier/Sort/TreeSortHandlers.php | 10 +- .../Pagination/PaginationInfoService.php | 2 +- .../Search/SearchExecutionService.php | 27 +- .../SearchExecutionServiceInterface.php | 6 +- .../ElementWorkspacesQueryService.php | 10 +- .../Workspace/QueryService.php | 12 +- .../AbstractAdapter.php | 7 +- .../AbstractAdapter.php | 5 + ...ElementWorkspacesQueryServiceInterface.php | 2 +- .../Workspace/QueryServiceInterface.php | 2 +- .../SearchIndex/SearchIndexConfigService.php | 6 + .../SearchIndexConfigServiceInterface.php | 2 + src/autoload.php | 108 +++++++ .../DefaultSearchServiceTest.php | 272 +++++++++++++++++ .../LocateInTreeServiceTest.php | 2 +- .../OpenSearch/OpenSearchServiceTest.php | 274 ------------------ .../Filter/AssetMetadataFilterTest.php | 2 +- .../Search/Modifier/Sort/SortModifierTest.php | 6 +- .../Functional/SearchIndex/AssetBasicTest.php | 5 +- .../SearchIndex/DataObjectBasicTest.php | 32 +- .../SearchIndex/DocumentBasicTest.php | 5 +- .../Functional/SearchIndex/IndexQueueTest.php | 8 +- tests/Support/Helper/GenericDataIndex.php | 28 +- .../Query/BoolQueryTest.php | 8 +- .../Query/DateFilterTest.php | 4 +- .../Query/QueryListTest.php | 8 +- .../Query/QueryTest.php | 4 +- .../Query/TermFilterTest.php | 4 +- .../Query/TermsFilterTest.php | 4 +- .../Query/WildcardFilterTest.php | 6 +- .../Search/Asset/AssetSearchTest.php | 2 +- .../DataObject/DataObjectSearchTest.php | 2 +- .../Search/Document/DocumentSearchTest.php | 2 +- .../Search/SearchModifierContextTest.php | 8 +- .../Traits/PaginatedSearchTraitTest.php | 2 +- tests/Unit/QueryLanguage/Pql/ParserTest.php | 4 +- .../BooleanAdapterTest.php | 4 +- .../DateAdapterTest.php | 6 +- .../KeywordAdapterTest.php | 6 +- .../RelationAdapterTest.php | 4 +- .../TextKeywordAdapterTest.php | 6 +- .../AdvancedImageAdapterTest.php | 6 +- .../AdvancedManyToManyRelationAdapterTest.php | 8 +- .../BooleanAdapterTest.php | 4 +- .../ClassificationStoreAdapterTest.php | 2 +- .../ConsentAdapterTest.php | 6 +- .../DateAdapterTest.php | 4 +- .../DateRangeAdapterTest.php | 4 +- .../DatetimeAdapterTest.php | 4 +- .../ExternalImageAdapterTest.php | 6 +- .../FieldCollectionAdapterTest.php | 6 +- .../GeographicBoundsAdapterTest.php | 4 +- .../GeographicPointAdapterTest.php | 4 +- .../ImageAdapterTest.php | 6 +- .../ImageGalleryAdapterTest.php | 6 +- .../LinkAdapterTest.php | 4 +- .../NumericAdapterTest.php | 4 +- .../NumericRangeAdapterTest.php | 2 +- .../ObjectBrickAdapterTest.php | 2 +- .../QuantityValueAdapterTest.php | 4 +- .../QuantityValueRangeAdapterTest.php | 4 +- .../RelationAdapterTest.php | 4 +- .../RgbaColorAdapterTest.php | 4 +- .../StructuredTableAdapterTest.php | 8 +- .../TextKeywordAdapterTest.php | 4 +- .../TimeAdapterTest.php | 4 +- .../UrlSlugAdapterTest.php | 4 +- .../VideoAdapterTest.php | 6 +- .../IndexMappingServiceTest.php | 55 +++- .../MappingAnalyzerServiceTest.php | 4 +- ...MetadataDefaultLanguageTransformerTest.php | 6 +- .../FieldCategoryTransformerTest.php | 6 +- .../IdTransformerTest.php | 6 +- .../ImageGalleryTransformerTest.php | 6 +- .../RelationsTransformerTest.php | 6 +- .../SynonymTransformerTest.php | 4 +- .../QueryLanguage/PqlAdapterTest.php | 8 +- tests/bin/docker-compose.yaml | 19 ++ tests/bin/init-functional-tests.sh | 26 +- 253 files changed, 3300 insertions(+), 1005 deletions(-) create mode 100644 .github/workflows/elastic-search-codeception.yaml rename .github/workflows/{codeception.yaml => open-search-codeception.yaml} (91%) rename config/services/search-index-adapter/{open-search.yaml => default-search.yaml} (56%) rename config/services/search-index-adapter/{open-search => default-search}/modifiers/modifier-service.yaml (82%) create mode 100644 config/services/search-index-adapter/default-search/modifiers/search-modifiers.yaml rename config/services/search-index-adapter/{open-search => default-search}/pql-field-name-transformers.yaml (54%) delete mode 100644 config/services/search-index-adapter/open-search/modifiers/search-modifiers.yaml create mode 100644 doc/02_Configuration/05_Elasticsearch.md rename doc/04_Searching_For_Data_In_Index/{06_OpenSearch_Search_Models => 06_Default_Search_Models}/README.md (70%) create mode 100644 src/Attribute/Search/AsSearchModifierHandler.php create mode 100644 src/Enum/SearchIndex/ClientType.php create mode 100644 src/Enum/SearchIndex/DefaultSearch/AttributeType.php create mode 100644 src/Enum/SearchIndex/DefaultSearch/ConditionType.php create mode 100644 src/Enum/SearchIndex/DefaultSearch/QueryType.php create mode 100644 src/Enum/SearchIndex/DefaultSearch/WildcardFilterMode.php rename src/Exception/{OpenSearch => DefaultSearch}/ResultWindowTooLargeException.php (87%) create mode 100644 src/Exception/DefaultSearch/SearchFailedException.php create mode 100644 src/Model/DefaultSearch/Aggregation/Aggregation.php create mode 100644 src/Model/DefaultSearch/Aggregation/AggregationList.php create mode 100644 src/Model/DefaultSearch/Debug/SearchInformation.php create mode 100644 src/Model/DefaultSearch/DefaultSearchInterface.php create mode 100644 src/Model/DefaultSearch/Modifier/SearchModifierContext.php create mode 100644 src/Model/DefaultSearch/Modifier/SearchModifierContextInterface.php create mode 100644 src/Model/DefaultSearch/Query/AsSubQueryInterface.php create mode 100644 src/Model/DefaultSearch/Query/BoolQuery.php create mode 100644 src/Model/DefaultSearch/Query/DateFilter.php create mode 100644 src/Model/DefaultSearch/Query/Query.php create mode 100644 src/Model/DefaultSearch/Query/QueryInterface.php create mode 100644 src/Model/DefaultSearch/Query/QueryList.php create mode 100644 src/Model/DefaultSearch/Query/SimpleQueryStringFilter.php create mode 100644 src/Model/DefaultSearch/Query/TermFilter.php create mode 100644 src/Model/DefaultSearch/Query/TermsFilter.php create mode 100644 src/Model/DefaultSearch/Query/WildcardFilter.php create mode 100644 src/Model/DefaultSearch/Search.php create mode 100644 src/Model/DefaultSearch/Sort/FieldSort.php create mode 100644 src/Model/DefaultSearch/Sort/FieldSortList.php create mode 100644 src/Model/DefaultSearch/Traits/QueryObjectsToArrayTrait.php create mode 100644 src/Model/DefaultSearch/Traits/SimplifySingleTypesTrait.php create mode 100644 src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Asset/FieldDefinitionAdapter/BooleanAdapter.php (88%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Asset/FieldDefinitionAdapter/DateAdapter.php (88%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Asset/FieldDefinitionAdapter/KeywordAdapter.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Asset/FieldDefinitionAdapter/RelationAdapter.php (93%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Asset/FieldDefinitionAdapter/TextKeywordAdapter.php (95%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Asset/FieldDefinitionService.php (98%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Asset/PredefinedAssetMetadataProvider.php (99%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/BulkOperationService.php (92%) create mode 100644 src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/AdvancedImageAdapter.php (94%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapter.php (89%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/BlockAdapter.php (97%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/BooleanAdapter.php (84%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php (98%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/ConsentAdapter.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/DateAdapter.php (91%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/DateRangeAdapter.php (92%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/DatetimeAdapter.php (91%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/ExternalImageAdapter.php (85%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/FieldCollectionAdapter.php (96%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapter.php (94%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/GeographicPointAdapter.php (93%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/HasLatitudeAnfLongitudeTrait.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/ImageAdapter.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/ImageGalleryAdapter.php (94%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/InputQuantityValueAdapter.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/LinkAdapter.php (94%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/LocalizedFieldsAdapter.php (98%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/NumericAdapter.php (84%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/NumericRangeAdapter.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/ObjectBrickAdapter.php (98%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/QuantityValueAdapter.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapter.php (88%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/RelationAdapter.php (93%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/RgbaColorAdapter.php (89%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/StructuredTableAdapter.php (95%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/TableAdapter.php (98%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php (96%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/TimeAdapter.php (84%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/UrlSlugAdapter.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionAdapter/VideoAdapter.php (95%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/FieldDefinitionService.php (98%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/DataObject/IndexIconUpdateService.php (92%) rename src/SearchIndexAdapter/{OpenSearch/OpenSearchService.php => DefaultSearch/DefaultSearchService.php} (82%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/IndexAliasService.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/IndexMappingService.php (90%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/IndexStatsService.php (90%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/MappingAnalyzerService.php (98%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/MappingAnalyzerServiceInterface.php (97%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/PathService.php (96%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformer.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/FieldCategoryTransformer.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/IdTransformer.php (83%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/ImageGalleryTransformer.php (85%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/KeywordTransformer.php (83%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/RelationsTransformer.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/SortTransformer.php (83%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/SynonymTransformer.php (89%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformerInterface.php (97%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameValidator/FieldExistsValidator.php (82%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameValidator/LocalizedFieldValidator.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameValidator/RelationValidator.php (87%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameValidatorInterface.php (90%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/PqlAdapter.php (99%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/SubQueriesProcessor.php (89%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/SubQueriesProcessorInterface.php (97%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/FetchIdsBySearchService.php (82%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/FetchIdsBySearchServiceInterface.php (71%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/FetchIdsService.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/LocateInTreeService.php (84%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Aggregation/AssetAggregations.php (90%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Aggregation/TreeAggregations.php (80%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Filter/AssetFilters.php (89%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Filter/BasicFilters.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Filter/DependencyFilters.php (86%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Filter/FieldTypeFilters.php (91%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Filter/TreeFilters.php (90%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Filter/Workspace/WorkspaceQueryHandler.php (90%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/FullTextSearch/FullTextSearchHandlers.php (85%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/QueryLanguage/QueryLanguageHandlers.php (82%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/SearchModifierService.php (92%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Sort/OrderByFieldsHandlers.php (84%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Modifier/Sort/TreeSortHandlers.php (91%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/Pagination/PaginationInfoService.php (97%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/SearchExecutionService.php (80%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Search/SearchExecutionServiceInterface.php (83%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Workspace/ElementWorkspacesQueryService.php (91%) rename src/SearchIndexAdapter/{OpenSearch => DefaultSearch}/Workspace/QueryService.php (96%) create mode 100644 src/autoload.php create mode 100644 tests/Functional/DefaultSearch/DefaultSearchServiceTest.php rename tests/Functional/{OpenSearch => DefaultSearch}/LocateInTreeServiceTest.php (99%) delete mode 100644 tests/Functional/OpenSearch/OpenSearchServiceTest.php rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Query/BoolQueryTest.php (94%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Query/DateFilterTest.php (98%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Query/QueryListTest.php (93%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Query/QueryTest.php (93%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Query/TermFilterTest.php (92%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Query/TermsFilterTest.php (92%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Query/WildcardFilterTest.php (95%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Search/Asset/AssetSearchTest.php (97%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Search/DataObject/DataObjectSearchTest.php (98%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Search/Document/DocumentSearchTest.php (97%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Search/SearchModifierContextTest.php (79%) rename tests/Unit/Model/{OpenSearch => DefaultSearch}/Search/Traits/PaginatedSearchTraitTest.php (98%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/IndexMappingServiceTest.php (86%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/MappingAnalyzerServiceTest.php (97%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformerTest.php (88%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/FieldCategoryTransformerTest.php (85%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/IdTransformerTest.php (84%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/ImageGalleryTransformerTest.php (86%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/RelationsTransformerTest.php (88%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/FieldNameTransformer/SynonymTransformerTest.php (89%) rename tests/Unit/SearchIndexAdapter/{OpenSearch => DefaultSearch}/QueryLanguage/PqlAdapterTest.php (84%) diff --git a/.github/ci/files/config/packages/test/config.yaml b/.github/ci/files/config/packages/test/config.yaml index 9e034a94..53aa93ab 100644 --- a/.github/ci/files/config/packages/test/config.yaml +++ b/.github/ci/files/config/packages/test/config.yaml @@ -36,6 +36,15 @@ pimcore_open_search_client: default: hosts: ['%env(PIMCORE_OPEN_SEARCH_HOST)%'] +pimcore_elasticsearch_client: + es_clients: + default: + hosts: ['%env(PIMCORE_ELASTIC_SEARCH_HOST)%'] + username: 'elastic' + password: 'somethingsecret' + logger_channel: 'pimcore.elasicsearch' + ssl_verification: false + pimcore: assets: metadata: diff --git a/.github/ci/files/config/services_test.yaml b/.github/ci/files/config/services_test.yaml index 48b18ef7..82037b2f 100644 --- a/.github/ci/files/config/services_test.yaml +++ b/.github/ci/files/config/services_test.yaml @@ -13,7 +13,7 @@ services: class: Pimcore\Tests\Support\Helper\DataType\Calculator Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\LocateInTreeServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\LocateInTreeService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\LocateInTreeService public: true Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\SearchResultIdListServiceInterface: diff --git a/.github/ci/scripts/setup-pimcore-environment-functional-tests.sh b/.github/ci/scripts/setup-pimcore-environment-functional-tests.sh index 975ae5d3..00e1bd81 100755 --- a/.github/ci/scripts/setup-pimcore-environment-functional-tests.sh +++ b/.github/ci/scripts/setup-pimcore-environment-functional-tests.sh @@ -2,5 +2,11 @@ .github/ci/scripts/setup-pimcore-environment.sh +# Add Elasticsearch config if specified +if [ "$1" == "elasticsearch" ]; then + CONFIG_FILE_PATH="config/packages/test/config.yaml" + echo -e "\n# Added by functional test script\npimcore_generic_data_index:\n index_service:\n client_params:\n client_type: 'elasticsearch'" >> "$CONFIG_FILE_PATH" +fi + cp .github/ci/files/composer.json . cp bundles/pimcore/generic-data-index-bundle/codeception.dist.yml . \ No newline at end of file diff --git a/.github/workflows/elastic-search-codeception.yaml b/.github/workflows/elastic-search-codeception.yaml new file mode 100644 index 00000000..4d6ddeb8 --- /dev/null +++ b/.github/workflows/elastic-search-codeception.yaml @@ -0,0 +1,119 @@ +name: "Codeception Tests with Elasticsearch" + +on: + # Enable Later. + #schedule: + # - cron: '0 3 * * 1,3,5' + pull_request: + branches: + - "[0-9]+.[0-9]+" + - "[0-9]+.x" + - "feature-*" + push: + branches: + - "[0-9]+.[0-9]+" + - "[0-9]+.x" + +env: + PIMCORE_PROJECT_ROOT: ${{ github.workspace }} + APP_ENV: test + PIMCORE_TEST: 1 + PIMCORE_TEST_DB_DSN: "mysql://root@127.0.0.1:33006/pimcore_test" + PIMCORE_ELASTIC_SEARCH_HOST: "localhost:5300" + CODECEPTION_BUNDLE_PATH: "bundles/pimcore/generic-data-index-bundle/" + +jobs: + codeception-tests: + name: "Codeception tests" + runs-on: "ubuntu-20.04" + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + include: + - { php-version: "8.3", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", experimental: true, search_engine: "elasticsearch"} + + services: + mariadb: + image: "mariadb:10.11" + ports: + - 33006:3306 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + + elastic: + image: elasticsearch:8.5.3 + ports: + - 5300:9200 + env: + discovery.type: "single-node" + ES_JAVA_OPTS: "-Xms1g -Xmx1g" + xpack.security.enabled: "true" + xpack.security.authc.anonymous.roles: "superuser,kibana_admin,kibana_system,kibana_user" + ELASTIC_USERNAME: "elastic" + ELASTIC_PASSWORD: "somethingsecret" + + steps: + - name: "Checkout code" + uses: "actions/checkout@v2" + with: + path: "bundles/pimcore/generic-data-index-bundle" + + - name: "Copy .github directory" + env: + REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}" + run: | + cp -R bundles/pimcore/generic-data-index-bundle/.github .github + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: xdebug + ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767 + php-version: "${{ matrix.php-version }}" + + - name: Verify MariaDB connection + run: | + cp .github/ci/files/.my.cnf ~/.my.cnf + while ! mysqladmin ping --silent; do + sleep 1 + done + + - name: "Setup Pimcore environment" + env: + REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}" + run: | + mysql -e "CREATE DATABASE pimcore_test CHARSET=utf8mb4;" + cp -R bundles/pimcore/generic-data-index-bundle/tests tests + mkdir src + chmod 755 .github/ci/scripts/setup-pimcore-environment-functional-tests.sh + .github/ci/scripts/setup-pimcore-environment-functional-tests.sh "${{ matrix.search_engine }}" + + - name: "Wait for Elasticsearch to be up" + run: | + if [ "${{ matrix.search_engine }}" == "elasticsearch" ]; then + echo "Waiting for Elasticsearch to be ready..." + until curl -s -u elastic:somethingsecret http://localhost:5300/_cluster/health | grep -q '"status":"green"'; do + echo "Waiting... Elasticsearch is not yet available." + sleep 5 + done + echo "Elasticsearch is up and running!" + else + echo "Using OpenSearch for testing, skipping Elasticsearch wait." + fi + + - name: "Update Pimcore version" + env: + PIMCORE_VERSION: "${{ matrix.pimcore_version }}" + run: | + if [ ! -z "$PIMCORE_VERSION" ]; then + composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}" + fi + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "${{ matrix.dependencies }}" + + - name: "Run Codeception" + run: | + vendor/bin/codecept run -c . -vvv --xml --coverage-xml diff --git a/.github/workflows/codeception.yaml b/.github/workflows/open-search-codeception.yaml similarity index 91% rename from .github/workflows/codeception.yaml rename to .github/workflows/open-search-codeception.yaml index f09d9db5..66a796c3 100644 --- a/.github/workflows/codeception.yaml +++ b/.github/workflows/open-search-codeception.yaml @@ -1,4 +1,4 @@ -name: "Codeception Tests" +name: "Codeception Tests with OpenSearch" on: # Enable Later. @@ -30,9 +30,9 @@ jobs: strategy: matrix: include: - - { php-version: "8.2", dependencies: "lowest", pimcore_version: "", experimental: false } - - { php-version: "8.3", dependencies: "highest", pimcore_version: "", experimental: false } - - { php-version: "8.3", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", experimental: true } + - { php-version: "8.2", dependencies: "lowest", pimcore_version: "", experimental: false, search_engine: "openSearch" } + - { php-version: "8.3", dependencies: "highest", pimcore_version: "", experimental: false, search_engine: "openSearch"} + - { php-version: "8.3", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", experimental: true, search_engine: "openSearch"} services: mariadb: @@ -89,7 +89,7 @@ jobs: cp -R bundles/pimcore/generic-data-index-bundle/tests tests mkdir src chmod 755 .github/ci/scripts/setup-pimcore-environment-functional-tests.sh - .github/ci/scripts/setup-pimcore-environment-functional-tests.sh + .github/ci/scripts/setup-pimcore-environment-functional-tests.sh "${{ matrix.search_engine }}" - name: "Update Pimcore version" env: diff --git a/README.md b/README.md index edf4ef45..ae1d437d 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,15 @@ title: Generic Data Index # Pimcore Generic Data Index -The Pimcore Generic Data Index Bundle provides a centralized way to index and search assets and data objects in Pimcore via OpenSearch indices. -It is shipped with the OpenSearch client and provides a central configuration for it in order to be used in other bundles. +The Pimcore Generic Data Index Bundle provides a centralized way to index and search elements (assets, data objects and documents) in Pimcore via indices (e.g OpenSearch, Elasticsearch). +It is shipped with the OpenSearch and Elasticsearch clients and provides a central configuration for them in order to be used in other bundles. This bundle can be extended and customized to fit your specific needs, for example if you would like to extend the search indices with custom attributes. ## Features in a Nutshell -- Based on OpenSearch +- Based on OpenSearch/Elasticsearch - Centralized data index for multiple bundles (Portal Engine, Studio API/UI, etc.) - Indexing of all documents, assets and data objects -- Provides search services and models to search, filter and aggregate the data saved in the OpenSearch indices +- Provides search services and models to search, filter and aggregate the data saved in the search indices ## Documentation Overview - [Installation](./doc/01_Installation/README.md) diff --git a/composer.json b/composer.json index abce3b4d..23683fe7 100644 --- a/composer.json +++ b/composer.json @@ -18,9 +18,10 @@ "minimum-stability": "dev", "require": { "php": "~8.2.0 || ~8.3.0 ", - "pimcore/pimcore": "^11.3.0", + "pimcore/pimcore": "^11.x-dev", "pimcore/static-resolver-bundle": "^1.4.0", - "pimcore/opensearch-client": "^1.0.0", + "pimcore/opensearch-client": "^1.x-dev", + "pimcore/elasticsearch-client": "^1.x-dev", "doctrine/orm": "^2.17.2", "symfony/scheduler": "^6.4", "symfony/messenger": "^6.4" @@ -42,7 +43,10 @@ "autoload": { "psr-4": { "Pimcore\\Bundle\\GenericDataIndexBundle\\": "src/" - } + }, + "files": [ + "src/autoload.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/config/services/search-index-adapter/open-search.yaml b/config/services/search-index-adapter/default-search.yaml similarity index 56% rename from config/services/search-index-adapter/open-search.yaml rename to config/services/search-index-adapter/default-search.yaml index 31626197..4e84a16b 100644 --- a/config/services/search-index-adapter/open-search.yaml +++ b/config/services/search-index-adapter/default-search.yaml @@ -1,79 +1,79 @@ imports: - - { resource: 'services/search-index-adapter/open-search/modifiers/*' } - - { resource: 'services/search-index-adapter/open-search/pql-field-name-transformers.yaml' } + - { resource: 'services/search-index-adapter/default-search/modifiers/*' } + - { resource: 'services/search-index-adapter/default-search/pql-field-name-transformers.yaml' } services: _defaults: autowire: true autoconfigure: true public: false - + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\SearchIndexServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\OpenSearchService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DefaultSearchService arguments: - $openSearchClient: '@generic-data-index.opensearch-client' + $client: '@generic-data-index.search-client' Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexAliasServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\IndexAliasService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\IndexAliasService arguments: - $openSearchClient: '@generic-data-index.opensearch-client' + $client: '@generic-data-index.search-client' - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\SearchExecutionServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\SearchExecutionService + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\SearchExecutionServiceInterface: + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\SearchExecutionService arguments: - $openSearchClient: '@generic-data-index.opensearch-client' + $client: '@generic-data-index.search-client' Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\BulkOperationServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\BulkOperationService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\BulkOperationService arguments: - $openSearchClient: '@generic-data-index.opensearch-client' + $client: '@generic-data-index.search-client' Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\PathServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\PathService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\PathService arguments: - $openSearchClient: '@generic-data-index.opensearch-client' + $client: '@generic-data-index.search-client' Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\Pagination\PaginationInfoServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Pagination\PaginationInfoService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Pagination\PaginationInfoService Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\LocateInTreeServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\LocateInTreeService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\LocateInTreeService Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\FetchIdsServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\FetchIdsService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\FetchIdsService - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\FetchIdsBySearchServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\FetchIdsBySearchService + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\FetchIdsBySearchServiceInterface: + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\FetchIdsBySearchService - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerService + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface: + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerService Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexStatsServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\IndexStatsService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\IndexStatsService arguments: - $openSearchClient: '@generic-data-index.opensearch-client' + $client: '@generic-data-index.search-client' Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\IndexMappingService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\IndexMappingService Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Workspace\QueryServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Workspace\QueryService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Workspace\QueryService Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Workspace\ElementWorkspacesQueryServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Workspace\ElementWorkspacesQueryService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Workspace\ElementWorkspacesQueryService Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\QueryLanguage\PqlAdapterInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\PqlAdapter + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\PqlAdapter - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\SubQueriesProcessorInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\SubQueriesProcessor + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\SubQueriesProcessorInterface: + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\SubQueriesProcessor - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameValidator\: - resource: '../../../src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator' + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameValidator\: + resource: '../../../src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator' tags: ['pimcore.generic_data_index.pql_field_name_validator'] Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\IndexIconUpdateServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\IndexIconUpdateService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\IndexIconUpdateService arguments: - $openSearchClient: '@generic-data-index.opensearch-client' \ No newline at end of file + $client: '@generic-data-index.search-client' \ No newline at end of file diff --git a/config/services/search-index-adapter/open-search/modifiers/modifier-service.yaml b/config/services/search-index-adapter/default-search/modifiers/modifier-service.yaml similarity index 82% rename from config/services/search-index-adapter/open-search/modifiers/modifier-service.yaml rename to config/services/search-index-adapter/default-search/modifiers/modifier-service.yaml index 3081b660..5c2c55d7 100644 --- a/config/services/search-index-adapter/open-search/modifiers/modifier-service.yaml +++ b/config/services/search-index-adapter/default-search/modifiers/modifier-service.yaml @@ -5,4 +5,4 @@ services: public: false Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\Modifier\SearchModifierServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\SearchModifierService \ No newline at end of file + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\SearchModifierService \ No newline at end of file diff --git a/config/services/search-index-adapter/default-search/modifiers/search-modifiers.yaml b/config/services/search-index-adapter/default-search/modifiers/search-modifiers.yaml new file mode 100644 index 00000000..9a417c6d --- /dev/null +++ b/config/services/search-index-adapter/default-search/modifiers/search-modifiers.yaml @@ -0,0 +1,24 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Aggregation\AssetAggregations: ~ + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Aggregation\TreeAggregations: ~ + + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter\BasicFilters: ~ + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter\AssetFilters: ~ + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter\TreeFilters: ~ + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter\DependencyFilters: ~ + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter\FieldTypeFilters: ~ + + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\FullTextSearch\FullTextSearchHandlers: ~ + + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Sort\TreeSortHandlers: ~ + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Sort\OrderByFieldsHandlers: ~ + + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\QueryLanguage\QueryLanguageHandlers: ~ + + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter\Workspace\WorkspaceQueryHandler: ~ \ No newline at end of file diff --git a/config/services/search-index-adapter/open-search/pql-field-name-transformers.yaml b/config/services/search-index-adapter/default-search/pql-field-name-transformers.yaml similarity index 54% rename from config/services/search-index-adapter/open-search/pql-field-name-transformers.yaml rename to config/services/search-index-adapter/default-search/pql-field-name-transformers.yaml index d9ab82d9..cc4f6f04 100644 --- a/config/services/search-index-adapter/open-search/pql-field-name-transformers.yaml +++ b/config/services/search-index-adapter/default-search/pql-field-name-transformers.yaml @@ -4,38 +4,38 @@ services: autoconfigure: true public: false - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\AssetMetadataDefaultLanguageTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\AssetMetadataDefaultLanguageTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer, priority: 9} - {name: pimcore.generic_data_index.pql_field_name_transformer_sort, priority: 9} - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\FieldCategoryTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\FieldCategoryTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer, priority: 10} - {name: pimcore.generic_data_index.pql_field_name_transformer_sort, priority: 10} - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\IdTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\IdTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer, priority: 5} - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\ImageGalleryTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\ImageGalleryTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer, priority: 6} - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\KeywordTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\KeywordTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer, priority: 0} - {name: pimcore.generic_data_index.pql_field_name_transformer_sort, priority: 0} - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\RelationsTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\RelationsTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer, priority: 0} - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\SortTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\SortTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer_sort, priority: 1} - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\SynonymTransformer: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\SynonymTransformer: tags: - {name: pimcore.generic_data_index.pql_field_name_transformer, priority: 11} - {name: pimcore.generic_data_index.pql_field_name_transformer_sort, priority: 11} \ No newline at end of file diff --git a/config/services/search-index-adapter/open-search/modifiers/search-modifiers.yaml b/config/services/search-index-adapter/open-search/modifiers/search-modifiers.yaml deleted file mode 100644 index bef8f93a..00000000 --- a/config/services/search-index-adapter/open-search/modifiers/search-modifiers.yaml +++ /dev/null @@ -1,24 +0,0 @@ -services: - _defaults: - autowire: true - autoconfigure: true - public: false - - - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Aggregation\AssetAggregations: ~ - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Aggregation\TreeAggregations: ~ - - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter\BasicFilters: ~ - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter\AssetFilters: ~ - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter\TreeFilters: ~ - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter\DependencyFilters: ~ - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter\FieldTypeFilters: ~ - - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\FullTextSearch\FullTextSearchHandlers: ~ - - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Sort\TreeSortHandlers: ~ - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Sort\OrderByFieldsHandlers: ~ - - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\QueryLanguage\QueryLanguageHandlers: ~ - - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter\Workspace\WorkspaceQueryHandler: ~ \ No newline at end of file diff --git a/config/services/search/asset/field-definition-adapters.yaml b/config/services/search/asset/field-definition-adapters.yaml index fbf155be..3c993d5f 100644 --- a/config/services/search/asset/field-definition-adapters.yaml +++ b/config/services/search/asset/field-definition-adapters.yaml @@ -4,31 +4,31 @@ services: autoconfigure: true public: false - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\TextKeywordAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\TextKeywordAdapter: shared: false tags: - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "input" } - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "textarea" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\KeywordAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\KeywordAdapter: shared: false tags: - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "select" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\RelationAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\RelationAdapter: shared: false tags: - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "asset" } - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "document" } - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "object" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\DateAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\DateAdapter: shared: false tags: - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "date" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\BooleanAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\BooleanAdapter: shared: false tags: - { name: "pimcore.generic_data_index.asset.search_index_field_definition", type: "checkbox" } diff --git a/config/services/search/asset/mapping-provider.yaml b/config/services/search/asset/mapping-provider.yaml index d257285a..fc1730ad 100644 --- a/config/services/search/asset/mapping-provider.yaml +++ b/config/services/search/asset/mapping-provider.yaml @@ -4,7 +4,7 @@ services: autoconfigure: true public: false - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\PredefinedAssetMetadataProvider: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\PredefinedAssetMetadataProvider: tags: - { name: "pimcore.generic_data_index.asset.mapping_provider", type: "predefined" } diff --git a/config/services/search/data-object/field-definition-adapters.yml b/config/services/search/data-object/field-definition-adapters.yml index 7de75a60..67e49500 100644 --- a/config/services/search/data-object/field-definition-adapters.yml +++ b/config/services/search/data-object/field-definition-adapters.yml @@ -4,7 +4,7 @@ services: autoconfigure: true public: false - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\TextKeywordAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\TextKeywordAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "wysiwyg" } @@ -24,54 +24,54 @@ services: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "email" } - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "gender" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\NumericAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\NumericAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "numeric" } - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "slider" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\DateAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\DateAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "date" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\DatetimeAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\DatetimeAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "datetime" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\DateRangeAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\DateRangeAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "dateRange" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\TimeAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\TimeAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "time" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\LocalizedFieldsAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\LocalizedFieldsAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "localizedfields" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\QuantityValueAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\QuantityValueAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "quantityValue" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\InputQuantityValueAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\InputQuantityValueAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "inputQuantityValue" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\BooleanAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\BooleanAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "checkbox" } - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "booleanSelect" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\RelationAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\RelationAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "manyToOneRelation" } @@ -80,106 +80,106 @@ services: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "reverseObjectRelation" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\AdvancedManyToManyRelationAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\AdvancedManyToManyRelationAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "advancedManyToManyRelation" } - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "advancedManyToManyObjectRelation" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ObjectBrickAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ObjectBrickAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "objectbricks" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\FieldCollectionAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\FieldCollectionAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "fieldcollections" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ClassificationStoreAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ClassificationStoreAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "classificationstore" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\RgbaColorAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\RgbaColorAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "rgbaColor" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\QuantityValueRangeAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\QuantityValueRangeAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "quantityValueRange" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\NumericRangeAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\NumericRangeAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "numericRange" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\GeographicPointAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\GeographicPointAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "geopoint" } - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "geopolygon" } - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "geopolyline" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\GeographicBoundsAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\GeographicBoundsAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "geobounds" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\UrlSlugAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\UrlSlugAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "urlSlug" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\LinkAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\LinkAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "link" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\BlockAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\BlockAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "block" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ConsentAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ConsentAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "consent" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ExternalImageAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ExternalImageAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "externalImage" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\VideoAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\VideoAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "video" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ImageAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ImageAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "image" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\AdvancedImageAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\AdvancedImageAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "hotspotimage" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ImageGalleryAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ImageGalleryAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "imageGallery" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\TableAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\TableAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "table" } - Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\StructuredTableAdapter: + Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\StructuredTableAdapter: shared: false tags: - { name: "pimcore.generic_data_index.data-object.search_index_field_definition", type: "structuredTable" } \ No newline at end of file diff --git a/config/services/search/index.yaml b/config/services/search/index.yaml index 98911e21..51ccbe1f 100644 --- a/config/services/search/index.yaml +++ b/config/services/search/index.yaml @@ -48,7 +48,7 @@ services: Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexService\IndexHandler\DataObjectIndexHandler: ~ Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionService arguments: - '@pimcore.generic_data_index.object.search_index_field_definition_locator' @@ -59,7 +59,7 @@ services: - [ ] Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Asset\FieldDefinitionServiceInterface: - class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionService + class: Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionService arguments: - '@pimcore.generic_data_index.asset.search_index_field_definition_locator' diff --git a/doc/01_Installation/README.md b/doc/01_Installation/README.md index 4bfd96cc..ae019c4e 100644 --- a/doc/01_Installation/README.md +++ b/doc/01_Installation/README.md @@ -4,7 +4,7 @@ This bundle is only supported on Pimcore Core Framework 11. - This bundle requires minimum version of OpenSearch 2.7. + This bundle requires minimum version of OpenSearch 2.7. or Elasticsearch 8.0.0. ::: @@ -35,9 +35,9 @@ return [ bin/console pimcore:bundle:install PimcoreGenericDataIndexBundle ``` -4) Setup open search client configuration in your Symfony configuration files (e.g. `config.yaml`): +4) Setup search client configuration in your Symfony configuration files (e.g. `config.yaml`): -See [OpenSearch Client Setup](../02_Configuration/04_Opensearch.md) for more information. +See [OpenSearch Client Setup](../02_Configuration/04_Opensearch.md) or [Elasticsearch Client Setup](../02_Configuration/05_Elasticsearch.md) for more information. 5) Setup one or multiple Symfony messenger workers for the indexing queue processing. It is recommended to use a tool like Supervisor to manage the workers. For more information, see the [Symfony Messenger documentation](https://symfony.com/doc/current/messenger.html). diff --git a/doc/02_Configuration/05_Elasticsearch.md b/doc/02_Configuration/05_Elasticsearch.md new file mode 100644 index 00000000..683993eb --- /dev/null +++ b/doc/02_Configuration/05_Elasticsearch.md @@ -0,0 +1,35 @@ +# Elasticsearch Client Setup + +:::info + +This bundle requires minimum version of Elasticsearch 8.0. + +::: + +Following configuration is required to set up Elasticsearch. The Elasticsearch client configuration takes place via [Pimcore Elasticsearch Client](https://github.com/pimcore/elasticsearch-client) and has two parts: +1) Configuring an Elasticsearch client. +2) Define the client to be used by Generic Data Index bundle. + +```yaml +# Configuring an Elasticsearch client +pimcore_elasticsearch_client: + es_clients: + default: + hosts: ['elastic:9200'] + username: 'elastic' + password: 'somethingsecret' + logger_channel: 'pimcore.elasicsearch' + +# Define the client to be used by your bundle (default client_type is 'openSearch') +pimcore_generic_data_index: + index_service: + client_params: + client_name: default + client_type: 'elasticsearch' +``` + +For the further configuration of the client, please refer to the [Pimcore Elasticsearch Client documentation](https://github.com/pimcore/elasticsearch-client/blob/1.x/README.md). + +## Important Elasticsearch Configuration + +Elasticsearch automatically creates indices on storing data if the index does not yet exist. This will cause issues with wrong indices and missing aliases. To overcome this issue, you need to disable that feature with the configuration `action.auto_create_index=false`. \ No newline at end of file diff --git a/doc/02_Configuration/README.md b/doc/02_Configuration/README.md index e2a07b04..344bdc8f 100644 --- a/doc/02_Configuration/README.md +++ b/doc/02_Configuration/README.md @@ -1,8 +1,9 @@ # Configuration of the Generic Data Index Bundle -The Generic Data Index Bundle provides a generic way to index and search data in Pimcore. It is shipped with the OpenSearch client and provides a central configuration for it in order to be used in other bundles. +The Generic Data Index Bundle provides a generic way to index and search data in Pimcore. It is shipped with the OpenSearch and Elasticsearch clients and provides a central configuration for it in order to be used in other bundles. This bundle can be extended and customized to fit your specific needs, for example if you would like to use a custom search engine. ## Further Reading - [Index management](./03_Index_Management.md) -- [OpenSearch setup](./04_Opensearch.md) \ No newline at end of file +- [OpenSearch setup](./04_Opensearch.md) +- [Elasticsearch setup](./05_Elasticsearch.md) \ No newline at end of file diff --git a/doc/04_Searching_For_Data_In_Index/05_Search_Modifiers/README.md b/doc/04_Searching_For_Data_In_Index/05_Search_Modifiers/README.md index 04efc78c..658cb283 100644 --- a/doc/04_Searching_For_Data_In_Index/05_Search_Modifiers/README.md +++ b/doc/04_Searching_For_Data_In_Index/05_Search_Modifiers/README.md @@ -12,30 +12,30 @@ $search->addModifier(new ParentIdFilter(1)) ### Filters -| Modifier | Modifier Category | Description | -|--------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [IdFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/IdFilter.php) | Basic filters | Filter by element ID | -| [IdsFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/IdsFilter.php) | Basic filters | Filter by multiple element IDs | -| [IntegerFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/IntegerFilter.php) | Basic filters | Filter integer fields based on the value with [PQL field name resolution support](#pql-field-name-resolution) | -| [ExcludeFoldersFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/ExcludeFoldersFilter.php) | Basic filters | Exclude folders from search result | -| [ParentIdsFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/ParentIdsFilter.php) | Tree related filters | Filter by parent ID | -| [PathFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/PathFilter.php) | Tree related filters | Filter by path (depending on use case for all levels or direct children only and with or without the parent item included) | -| [TagFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/TagFilter.php) | Tree related filters | Filter by tag IDs (it is also possible to include child tags) | -| [AssetMetaDataFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Asset/AssetMetaDataFilter.php) | Asset filters | Filter by asset meta data attribute. The format of the `$data` which needs to be passed depends on the type of the meta data attribute and is handled by its [field definition adapter](https://github.com/pimcore/generic-data-index-bundle/tree/1.x/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter). | -| [WorkspaceQuery](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Workspaces/WorkspaceQuery.php) | Workspace related filters | Filter based on the user workspaces and permissions for a defined element type (this query is added to the asset/document/data object search by default) | -| [ElementWorkspacesQuery](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Workspaces/WorkspaceQuery.php) | Workspace related filters | Filter based on the user workspaces and permissions respecting all element types (this query is added to the element search by default) | -| [MultiSelectFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/FieldType/MultiSelectFilter.php) | Field type filters | Filter text fields by a list of exact strings. Supports [PQL field name resolution](#pql-field-name-resolution). | -| [DateFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/FieldType/DateFilter.php) | Field type filters | Filter date fields based on an exact date or a range of dates. Supports [PQL field name resolution](#pql-field-name-resolution). | +| Modifier | Modifier Category | Description | +|--------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [IdFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/IdFilter.php) | Basic filters | Filter by element ID | +| [IdsFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/IdsFilter.php) | Basic filters | Filter by multiple element IDs | +| [IntegerFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/IntegerFilter.php) | Basic filters | Filter integer fields based on the value with [PQL field name resolution support](#pql-field-name-resolution) | +| [ExcludeFoldersFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/ExcludeFoldersFilter.php) | Basic filters | Exclude folders from search result | +| [ParentIdsFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/ParentIdsFilter.php) | Tree related filters | Filter by parent ID | +| [PathFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/PathFilter.php) | Tree related filters | Filter by path (depending on use case for all levels or direct children only and with or without the parent item included) | +| [TagFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Tree/TagFilter.php) | Tree related filters | Filter by tag IDs (it is also possible to include child tags) | +| [AssetMetaDataFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Asset/AssetMetaDataFilter.php) | Asset filters | Filter by asset meta data attribute. The format of the `$data` which needs to be passed depends on the type of the meta data attribute and is handled by its [field definition adapter](https://github.com/pimcore/generic-data-index-bundle/tree/1.x/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter). | +| [WorkspaceQuery](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Workspaces/WorkspaceQuery.php) | Workspace related filters | Filter based on the user workspaces and permissions for a defined element type (this query is added to the asset/document/data object search by default) | +| [ElementWorkspacesQuery](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Workspaces/WorkspaceQuery.php) | Workspace related filters | Filter based on the user workspaces and permissions respecting all element types (this query is added to the element search by default) | +| [MultiSelectFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/FieldType/MultiSelectFilter.php) | Field type filters | Filter text fields by a list of exact strings. Supports [PQL field name resolution](#pql-field-name-resolution). | +| [DateFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/FieldType/DateFilter.php) | Field type filters | Filter date fields based on an exact date or a range of dates. Supports [PQL field name resolution](#pql-field-name-resolution). | ### Full Text Search Queries -| Modifier | Modifier Category | Description | -|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| -| [ElementKeySearch](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/FullTextSearch/ElementKeySearch.php) | Full text search | Search by element key like in the studio UI with [wildcard support](#wildcard-support). | -| [FullTextSearch](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/FullTextSearch/FullTextSearch.php) | Full text search | Search on all element fields by value with [simple query string syntax](https://opensearch.org/docs/latest/query-dsl/full-text/simple-query-string/#simple-query-string-syntax). | -| [WildcardSearch](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/FullTextSearch/WildcardSearch.php) | Full text search | Filter text fields based on search terms with [wildcard support](#wildcard-support) and [PQL field name resolution support](#pql-field-name-resolution). | +| Modifier | Modifier Category | Description | +|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [ElementKeySearch](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/FullTextSearch/ElementKeySearch.php) | Full text search | Search by element key like in the studio UI with [wildcard support](#wildcard-support). | +| [FullTextSearch](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/FullTextSearch/FullTextSearch.php) | Full text search | Search on all element fields by value with simple query string syntax for [OpenSearch](https://opensearch.org/docs/latest/query-dsl/full-text/simple-query-string/#simple-query-string-syntax) or [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html#simple-query-string-syntax). | +| [WildcardSearch](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/FullTextSearch/WildcardSearch.php) | Full text search | Filter text fields based on search terms with [wildcard support](#wildcard-support) and [PQL field name resolution support](#pql-field-name-resolution). | ### Dependencies @@ -56,12 +56,12 @@ $search->addModifier(new ParentIdFilter(1)) If multiple sort modifiers are added to the search, the order of the modifiers is important. The search result will be sorted by the first added modifier first, then by the second added modifier and so on. -| Modifier | Modifier Category | Description | -|----------------------------------------------------------------------------------------------------------------------------------------------|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [OrderByFullPath](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByFullPath.php) | Tree related sorting | Order by full path (including element key) | -| [OrderByField](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/OrderByField.php) | Field based sorting | Order by given field name.
If `$enablePqlFieldNameResolution` is set to true (default) [Pimcore Query Language](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/OrderByField.php) field name resolution logic is enabled. Therefore it's possible to use short field names then instead of specifying the full path in OpenSearch. | -| [OrderByPageNumber](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByPageNumber.php) | Search related sorting | Use inverted search for large amounts of data (this modifier is added to the search when there are at least 1000 results by default, and page number is above the half of total pages. Furthermore, existing sorting has to be already applied.) | -| [OrderByIndexField](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByIndexField.php) | Search related sorting | Order by object tree index for custom tree sorting. This modifier is currently applied only for data objects! | +| Modifier | Modifier Category | Description | +|----------------------------------------------------------------------------------------------------------------------------------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [OrderByFullPath](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByFullPath.php) | Tree related sorting | Order by full path (including element key) | +| [OrderByField](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/OrderByField.php) | Field based sorting | Order by given field name.
If `$enablePqlFieldNameResolution` is set to true (default) [Pimcore Query Language](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/OrderByField.php) field name resolution logic is enabled. Therefore it's possible to use short field names then instead of specifying the full indexed path. | +| [OrderByPageNumber](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByPageNumber.php) | Search related sorting | Use inverted search for large amounts of data (this modifier is added to the search when there are at least 1000 results by default, and page number is above the half of total pages. Furthermore, existing sorting has to be already applied.) | +| [OrderByIndexField](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Sort/Tree/OrderByIndexField.php) | Search related sorting | Order by object tree index for custom tree sorting. This modifier is currently applied only for data objects! | ### Aggregations @@ -82,7 +82,7 @@ For some search modifiers, wildcard support is available. Wildcards support the ### PQL field name resolution -Some modifiers support [Pimcore Query Language (PQL)](../09_Pimcore_Query_Language/README.md) field name resolution by setting `$enablePqlFieldNameResolution` to `true` (enabled by default). Therefore, it's possible to use short field names then instead of specifying the full path in OpenSearch. +Some modifiers support [Pimcore Query Language (PQL)](../09_Pimcore_Query_Language/README.md) field name resolution by setting `$enablePqlFieldNameResolution` to `true` (enabled by default). Therefore, it's possible to use short field names then instead of specifying the full indexed path. ## Add your own search modifier @@ -91,11 +91,11 @@ To add a custom search modifier implementation two steps are necessary: 1. Create a new class that implements the `Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\ModifierInterface` interface. This model class should contain all configurable attributes for the modifier. Take a look at the [IdFilter](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/Search/Modifier/Filter/Basic/IdFilter.php) for an example. -2. Create a service to implement the logic behind the modifier and add the [AsSearchModifierHandler](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Attribute/OpenSearch/AsSearchModifierHandler.php) attribute. +2. Create a service to implement the logic behind the modifier and add the [AsSearchModifierHandler](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Attribute/DefaultSearch/AsSearchModifierHandler.php) attribute. The attribute can either be directly added to the method which implements to logic or to a class. If added to a class the ´__invoke` method will be used as the handler. The implemented method needs exactly two arguments.: * First argument: the modifier model (see step 1). -* Second argument: [SearchModifierContextInterface](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/OpenSearch/Modifier/SearchModifierContextInterface.php) $context +* Second argument: [SearchModifierContextInterface](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/Model/DefaultSearch/Modifier/SearchModifierContextInterface.php) $context -Take a look at the [BasicFilters](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/BasicFilters.php) for an example and the [OpenSearch search models documentation](../06_OpenSearch_Search_Models/README.md) for more details about the search models to manipulate the search. \ No newline at end of file +Take a look at the [BasicFilters](https://github.com/pimcore/generic-data-index-bundle/blob/1.x/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/BasicFilters.php) for an example and the [Default search models documentation](../06_Default_Search_Models/README.md) for more details about the search models to manipulate the search. \ No newline at end of file diff --git a/doc/04_Searching_For_Data_In_Index/06_OpenSearch_Search_Models/README.md b/doc/04_Searching_For_Data_In_Index/06_Default_Search_Models/README.md similarity index 70% rename from doc/04_Searching_For_Data_In_Index/06_OpenSearch_Search_Models/README.md rename to doc/04_Searching_For_Data_In_Index/06_Default_Search_Models/README.md index eb4269eb..8d22d628 100644 --- a/doc/04_Searching_For_Data_In_Index/06_OpenSearch_Search_Models/README.md +++ b/doc/04_Searching_For_Data_In_Index/06_Default_Search_Models/README.md @@ -1,8 +1,16 @@ -# OpenSearch Search Models +# Default Search Models -OpenSearch search models can be used when individual OpenSearch queries are needed to streamline the creation of OpenSearch search JSONs. +:::info -This is especially useful when you want to create your own [search modifiers](../05_Search_Modifiers/README.md) or when you would like to create services which should directly execute searches through the OpenSearch client. They are used by the Generic Data Index and its search services internally to handle the execution of search queries on a lower level. +All models under namespace `Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch` are deprecated and will be removed in version 2.0 + +Please use models from `Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch` instead. + +::: + +Default search models can be used when individual search queries are needed to streamline the creation of Elasticsearch or OpenSearch search JSONs. + +This is especially useful when you want to create your own [search modifiers](../05_Search_Modifiers/README.md) or when you would like to create services which should directly execute searches through the search client. They are used by the Generic Data Index and its search services internally to handle the execution of search queries on a lower level. ## Example usage in search modifier @@ -26,7 +34,8 @@ public function handleCustomFilter(CustomFilter $customFilter, SearchModifierCon The search model is the main model to create a search query. It can be used to add queries, filters, aggregations and sorting to the search. ```php -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; + $search = (new Search()) ->setSize(10) // set the number of results to return ->setFrom(0) // set the offset of the results @@ -36,7 +45,7 @@ $search = (new Search()) ->addAggregation(new Aggregation('test-aggregation',[...])) // add an aggregation ; -$result = $openSearchClient->search( [ +$result = $searchClient->search( [ 'index' => $indexName, 'body' => $search->toArray() ]); @@ -44,15 +53,16 @@ $result = $openSearchClient->search( [ ## Query Models -The query models are used to create a query for the search. They can be used to create any query which is supported by OpenSearch. +The query models are used to create a query for the search. They can be used to create any query which is supported by OpenSearch or Elasticsearch. ### BoolQuery -Represents a boolean query. It can be used to combine multiple queries with boolean operators. See OpenSearch [documentation](https://opensearch.org/docs/latest/query-dsl/compound/bool/) for more details. +Represents a boolean query. It can be used to combine multiple queries with boolean operators. See documentation for [OpenSearch](https://opensearch.org/docs/latest/query-dsl/compound/bool/) or [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html) for more details. #### Basic usage + ```php -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; $boolQuery = new BoolQuery([ 'should' => [ @@ -85,7 +95,7 @@ $boolQueryB = new BoolQuery([ ], ]); -// this will result in a query with two should conditions +// this will result in a query with two "should" conditions $boolQueryA->merge($boolQueryB); ``` @@ -104,7 +114,7 @@ $boolQuery = new BoolQuery([ The term filter combines a boolean query with a term query. It can be used to filter the search results by a term. ```php -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter; $termFilter = new TermFilter('field', 'value'); ``` @@ -117,7 +127,7 @@ The terms filter combines a boolean query with a terms query. It can be used to The wildcard filter combines a boolean query with a wildcard query. It can be used to filter the search results by terms using * as wildcard. ```php -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\WildcardFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\WildcardFilter; $wildcardFilter = new WildcardFilter('field', 'value*'); ``` @@ -128,7 +138,7 @@ It is possible to influence the wildcard filter behaviour by setting additional The date filter can be used to filter the search results by a date range or exact date. ```php -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\DateFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter; // date range $dateFilter = new DateFilter('datefield', strtotime('2000-01-01'), strtotime('2099-12-31')); @@ -148,10 +158,10 @@ $dateFilter = new DateFilter('datefield', null, null, strtotime('2000-01-01 12:0 ### Generic Query -The generic `Query` model can be used to create any query which is supported by OpenSearch. It can be used to create custom queries which are not covered by the other query models. +The generic `Query` model can be used to create any query which is supported by OpenSearch or Elasticsearch. It can be used to create custom queries which are not covered by the other query models. ```php -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\Query; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\Query; $matchQuery = new Query('match', [ 'field' => 'value' @@ -168,10 +178,10 @@ $rangeQuery = new Query('range', [ ## Aggregation Model -The aggregation model is used to create an aggregation for the search. It can be used to create any aggregation which is supported by OpenSearch. It's just a simple wrapper class without any special logic. +The aggregation model is used to create an aggregation for the search. It can be used to create any aggregation which is supported by OpenSearch or Elasticsearch. It's just a simple wrapper class without any special logic. ```php -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation; $aggregation = new Aggregation('test-aggregation', [ 'terms' => [ diff --git a/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/03_Use_PQL_as_Developer.md b/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/03_Use_PQL_as_Developer.md index fdba58e6..ee3df450 100644 --- a/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/03_Use_PQL_as_Developer.md +++ b/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/03_Use_PQL_as_Developer.md @@ -22,7 +22,7 @@ $query = $queryLanguageProcessor->process( $indexEntityService->getByEntityName('Car') // 'Asset', 'Document' or the name of the data object class ); -// $query is now a valid OpenSearch query array which can be used to search in the index +// $query is now a valid search index query array which can be used to search in the index ``` ## Exception Handling diff --git a/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/README.md b/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/README.md index 90b96c5c..1e706aed 100644 --- a/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/README.md +++ b/doc/04_Searching_For_Data_In_Index/09_Pimcore_Query_Language/README.md @@ -79,7 +79,7 @@ The entity name can be either 'Asset', 'Document' or the name of the data object ### Field Names -The field names are named and structured the same way like in the OpenSearch index. Nested field names are supported with a dot ('.') notation. +The field names are named and structured the same way as in the search index. Nested field names are supported with a dot ('.') notation. As described [here](../../05_Extending_Data_Index/06_Extend_Search_Index.md) the fields are separated into three sections (system_fields, standard_fields and custom_fields) and depending on the data type of a attribute the attribute value could be a nested structure with sub-attributes. @@ -107,7 +107,8 @@ Localized fields can be accessed in the form 'field_name.locale' (e.g. descripti ### Query String Query Filters -The PQL allows passing OpenSearch [query string queries](https://opensearch.org/docs/latest/query-dsl/full-text/query-string/#query-string-syntax) directly to the index. The query string query syntax provides even more flexibility to define the search criteria. Take a look at the [OpenSearch documentation](https://opensearch.org/docs/latest/query-dsl/full-text/query-string/#query-string-syntax) for more details. +The PQL allows passing `query string queries` of [OpenSearch](https://opensearch.org/docs/latest/query-dsl/full-text/query-string) or [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) directly to the index. +The query string query syntax provides even more flexibility to define the search criteria. Take a look at the [OpenSearch documentation](https://opensearch.org/docs/latest/query-dsl/full-text/query-string/#query-string-syntax) or [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax) respectively for more details. **Caution**: The automatic field detection is not supported for query string queries. So you have to use the full path for the field names. @@ -126,7 +127,7 @@ All examples are based on the `Car` data object class of the [Pimcore Demo](http ## Limitations -* When searching for related elements the maximum possible results amount of sub queries is 65.000, see also [terms query documentation](https://opensearch.org/docs/latest/query-dsl/term/terms/). +* When searching for related elements the maximum possible results amount of sub queries is 65.000, see also `terms query` [OpenSearch](https://opensearch.org/docs/latest/query-dsl/term/terms/) or [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html) documentation respectively. * Filtering for asset metadata fields is only possible if they are defined as predefined asset metadata or via the asset metadata class definitions bundle. Custom asset metadata fields directly defined on single assets are not supported. * Reserved keywords (`AND`, `OR`, `LIKE`, `NOT LIKE`, `NULL`, `EMPTY`) cannot be used as field names. diff --git a/doc/04_Searching_For_Data_In_Index/README.md b/doc/04_Searching_For_Data_In_Index/README.md index 764a77fd..4f110e68 100644 --- a/doc/04_Searching_For_Data_In_Index/README.md +++ b/doc/04_Searching_For_Data_In_Index/README.md @@ -127,10 +127,10 @@ public function searchAction(SearchProviderInterface $searchProvider, SearchResu } ``` -## OpenSearch Search Models -The search services mentioned above offer a flexible and structured way to search for assets, data objects and documents. Nevertheless if there are requirements which are not covered by the search services it might be needed to develop your own customized open search queries. The OpenSearch search models offer a streamlined way for executing such customized search queries. They are also used by the search services internally to create the executed OpenSearch search queries. +## Default Search Models +The search services mentioned above offer a flexible and structured way to search for assets, data objects and documents. Nevertheless, if there are requirements which are not covered by the search services it might be needed to develop your own customized search queries. Default search models offer a streamlined way for executing such customized search queries. They are also used by the search services internally to create the executed search queries. -Take a look at the dedicated [OpenSearch search models documentation](06_OpenSearch_Search_Models/README.md) to find out more. +Take a look at the dedicated [Default search models documentation](06_Default_Search_Models/README.md) to find out more. ## Permissions The search service respects the user permissions and user workspaces in connection to his roles. @@ -141,9 +141,9 @@ Details about permissions and workspaces can be found in the [permissions and wo The [Pimcore Query Language (PQL)](./09_Pimcore_Query_Language/README.md) is a query language which can be used to provide the user a flexible way to define search criteria for data objects, assets and documents. -## Debug OpenSearch Queries -To debug the OpenSearch queries which are created by the search service, it is possible to use the following magic parameter in the URL (when debug mode is enabled): +## Debug Search Queries +To debug the Search queries which are created by the search service, it is possible to use the following magic parameter in the URL (when debug mode is enabled): -| Get Parameter | Description | -|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `debug-open-search-queries` | Will change the response of the called URL and outputs all executed OpenSearch queries.

It is possible to influence the output verbosity with the value of the parameter (1=normal, 2=verbose, 3=very verbose) | +| Get Parameter | Description | +|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `debug-search-queries` | Will change the response of the called URL and outputs all executed search queries.

It is possible to influence the output verbosity with the value of the parameter (1=normal, 2=verbose, 3=very verbose) | diff --git a/doc/05_Extending_Data_Index/06_Extend_Search_Index.md b/doc/05_Extending_Data_Index/06_Extend_Search_Index.md index c6444bbe..12b9e130 100644 --- a/doc/05_Extending_Data_Index/06_Extend_Search_Index.md +++ b/doc/05_Extending_Data_Index/06_Extend_Search_Index.md @@ -52,7 +52,7 @@ they are searchable through the full text search (depending on the mapping of th ### ExtractMappingEvent -With this event it's possible to define the [mapping](https://opensearch.org/docs/latest/field-types/) +With this event it's possible to define the mapping (for elasticsearch see [this mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html) and for openSearch please refer to [mapping](https://opensearch.org/docs/latest/field-types/)) of the additional custom fields. Again there are separate events for assets and data objects. * `Pimcore\Bundle\GenericDataIndexBundle\Event\Asset\ExtractMappingEvent` (assets) @@ -121,9 +121,9 @@ class FileSizeIndexSubscriber implements EventSubscriberInterface $customFieldsMapping = $event->getCustomFieldsMapping(); /** - * Take a look at the OpenSearch docs how mapping works. + * Take a look at the docs how mapping works. * A 'keyword' field would be best for regular select and multi select filters. - * For full text search it is possible to define sub-fields with special OpenSearch analyzers too. + * For full text search it is possible to define sub-fields with special search index analyzers too. */ $customFieldsMapping['fileSizeSelection'] = [ 'type' => 'keyword' @@ -200,9 +200,9 @@ class CarOwnerSubscriber implements EventSubscriberInterface $customFieldsMapping = $event->getCustomFieldsMapping(); /** - * Take a look at the OpenSearch docs how mapping works. + * Take a look at the docs how mapping works. * A 'keyword' field would be best for regular select and multi select filters. - * For full text search it is possible to define sub-fields with special OpenSearch analyzers too. + * For full text search it is possible to define sub-fields with special search index analyzers too. */ $customFieldsMapping['numberOfVariants'] = [ 'type' => 'integer' diff --git a/phpstan.neon b/phpstan.neon index 26b77cd0..0597980f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,6 +7,8 @@ parameters: - phpstan-bootstrap.php excludePaths: - src/Tests/* + #ToDo remove in version 2.0 + - src/Model/OpenSearch/* includes: - phpstan-baseline.neon \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties index 0495f8c2..69b47673 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -9,7 +9,8 @@ sonar.organization=pimcore # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. #sonar.sources=. -sonar.exclusions=**/vendor/**,**/doc/**,**/tests/**,**/config/**,**/.docker/** +# ToDo: Remove **/src/autoload.php in version 2.0 +sonar.exclusions=**/vendor/**,**/doc/**,**/tests/**,**/config/**,**/.docker/**,**/src/autoload.php # Encoding of the source code. Default is default system encoding #sonar.sourceEncoding=UTF-8 \ No newline at end of file diff --git a/src/Attribute/OpenSearch/AsSearchModifierHandler.php b/src/Attribute/OpenSearch/AsSearchModifierHandler.php index ac8be1f0..49aa4a54 100644 --- a/src/Attribute/OpenSearch/AsSearchModifierHandler.php +++ b/src/Attribute/OpenSearch/AsSearchModifierHandler.php @@ -18,6 +18,10 @@ use Attribute; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler instead + */ #[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] class AsSearchModifierHandler { diff --git a/src/Attribute/Search/AsSearchModifierHandler.php b/src/Attribute/Search/AsSearchModifierHandler.php new file mode 100644 index 00000000..8bce1e48 --- /dev/null +++ b/src/Attribute/Search/AsSearchModifierHandler.php @@ -0,0 +1,24 @@ +addDefaultsIfNotSet() ->children() ->scalarNode('client_name') - ->info('Name of OpenSearch client from the PimcoreOpenSearchClientBundle to be used.') + ->info('Name of search client from to be used.') ->defaultValue('default') ->end() + ->enumNode('client_type') + ->info('Type of search client to be used.') + ->values([ClientType::OPEN_SEARCH->value, ClientType::ELASTIC_SEARCH->value]) + ->defaultValue(ClientType::OPEN_SEARCH->value) + ->end() ->scalarNode('index_prefix') ->defaultValue('pimcore_') ->end() diff --git a/src/DependencyInjection/PimcoreGenericDataIndexExtension.php b/src/DependencyInjection/PimcoreGenericDataIndexExtension.php index 2debfabd..47a8de2a 100644 --- a/src/DependencyInjection/PimcoreGenericDataIndexExtension.php +++ b/src/DependencyInjection/PimcoreGenericDataIndexExtension.php @@ -18,6 +18,7 @@ use Exception; use InvalidArgumentException; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ClientType; use Pimcore\Bundle\GenericDataIndexBundle\MessageHandler\DispatchQueueMessagesHandler; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Symfony\Component\Config\FileLocator; @@ -84,17 +85,44 @@ public function prepend(ContainerBuilder $container): void private function registerIndexServiceParams(ContainerBuilder $container, array $indexSettings): void { $definition = $container->getDefinition(SearchIndexConfigServiceInterface::class); + $definition->setArgument('$clientType', $indexSettings['client_params']['client_type']); $definition->setArgument('$indexPrefix', $indexSettings['client_params']['index_prefix']); $definition->setArgument('$indexSettings', $indexSettings['index_settings']); $definition->setArgument('$searchSettings', $indexSettings['search_settings']); $definition->setArgument('$systemFieldsSettings', $indexSettings['system_fields_settings']); $openSearchClientId = 'pimcore.open_search_client.' . $indexSettings['client_params']['client_name']; - $container->setAlias('generic-data-index.opensearch-client', $openSearchClientId); + $container->setAlias('generic-data-index.opensearch-client', $openSearchClientId) + ->setDeprecated( + 'pimcore/generic-data-index-bundle', + '1.3', + 'The "%alias_id%" service alias is deprecated and will be removed in version 2.0. ' . + 'Please use "generic-data-index.search-client" instead.' + ); + + $clientId = $this->getDefaultSearchClientId($indexSettings); + $container->setAlias('generic-data-index.search-client', $clientId); $container->setParameter('generic-data-index.index-prefix', $indexSettings['client_params']['index_prefix']); $definition = $container->getDefinition(DispatchQueueMessagesHandler::class); $definition->setArgument('$queueSettings', $indexSettings['queue_settings']); } + + /** + * @throws InvalidArgumentException + */ + private function getDefaultSearchClientId(array $indexSettings): string + { + $clientType = $indexSettings['client_params']['client_type']; + $clientName = $indexSettings['client_params']['client_name']; + + return match ($clientType) { + ClientType::OPEN_SEARCH->value => 'pimcore.openSearch.custom_client.' . $clientName, + ClientType::ELASTIC_SEARCH->value => 'pimcore.elasticsearch.custom_client.' . $clientName, + default => throw new InvalidArgumentException( + sprintf('Invalid client type: %s', $indexSettings['client_params']['client_type']) + ) + }; + } } diff --git a/src/Enum/SearchIndex/ClientType.php b/src/Enum/SearchIndex/ClientType.php new file mode 100644 index 00000000..ca7b606f --- /dev/null +++ b/src/Enum/SearchIndex/ClientType.php @@ -0,0 +1,26 @@ +searchIndexService instanceof OpenSearchService) { + if (!$this->searchIndexService instanceof DefaultSearchService) { return; } if (!Pimcore::inDebugMode() || empty($event->getRequest()->query->get(self::DEBUG_SEARCH_PARAM))) { @@ -57,7 +57,7 @@ public function onKernelResponse(ResponseEvent $event): void private function getNormalizedSearches(int $verbosity): array { - if (!$this->searchIndexService instanceof OpenSearchService) { + if (!$this->searchIndexService instanceof DefaultSearchService) { return []; } diff --git a/src/Exception/OpenSearch/ResultWindowTooLargeException.php b/src/Exception/DefaultSearch/ResultWindowTooLargeException.php similarity index 87% rename from src/Exception/OpenSearch/ResultWindowTooLargeException.php rename to src/Exception/DefaultSearch/ResultWindowTooLargeException.php index 75990508..47d4cd61 100644 --- a/src/Exception/OpenSearch/ResultWindowTooLargeException.php +++ b/src/Exception/DefaultSearch/ResultWindowTooLargeException.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Exception\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch; use Pimcore\Bundle\GenericDataIndexBundle\Exception\GenericDataIndexBundleExceptionInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Debug\SearchInformation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Debug\SearchInformation; use RuntimeException; use Throwable; diff --git a/src/Exception/DefaultSearch/SearchFailedException.php b/src/Exception/DefaultSearch/SearchFailedException.php new file mode 100644 index 00000000..241c35a5 --- /dev/null +++ b/src/Exception/DefaultSearch/SearchFailedException.php @@ -0,0 +1,39 @@ +searchInformation; + } +} diff --git a/src/Exception/OpenSearch/SearchFailedException.php b/src/Exception/OpenSearch/SearchFailedException.php index a58b6962..cd234027 100644 --- a/src/Exception/OpenSearch/SearchFailedException.php +++ b/src/Exception/OpenSearch/SearchFailedException.php @@ -21,6 +21,10 @@ use RuntimeException; use Throwable; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch\SearchFailedException instead + */ final class SearchFailedException extends RuntimeException implements GenericDataIndexBundleExceptionInterface { public function __construct( diff --git a/src/Model/DefaultSearch/Aggregation/Aggregation.php b/src/Model/DefaultSearch/Aggregation/Aggregation.php new file mode 100644 index 00000000..b8b79f67 --- /dev/null +++ b/src/Model/DefaultSearch/Aggregation/Aggregation.php @@ -0,0 +1,36 @@ +name; + } + + public function getParams(): array + { + return $this->params; + } +} diff --git a/src/Model/DefaultSearch/Aggregation/AggregationList.php b/src/Model/DefaultSearch/Aggregation/AggregationList.php new file mode 100644 index 00000000..0d4e59fd --- /dev/null +++ b/src/Model/DefaultSearch/Aggregation/AggregationList.php @@ -0,0 +1,51 @@ +aggregations[] = $aggregation; + } + + return $this; + } + + public function isEmpty(): bool + { + return empty($this->aggregations); + } + + public function toArray(): array + { + $result = []; + + foreach ($this->aggregations as $aggregation) { + $result[$aggregation->getName()] = $aggregation->getParams(); + } + + return $result; + } +} diff --git a/src/Model/DefaultSearch/Debug/SearchInformation.php b/src/Model/DefaultSearch/Debug/SearchInformation.php new file mode 100644 index 00000000..6e5c5c09 --- /dev/null +++ b/src/Model/DefaultSearch/Debug/SearchInformation.php @@ -0,0 +1,83 @@ +search; + } + + public function isSuccess(): bool + { + return $this->success; + } + + public function getResponse(): array + { + return $this->response; + } + + public function getExecutionTime(): int|float + { + return $this->executionTime; + } + + public function getStackTrace(): array + { + return $this->stackTrace; + } + + public function toArray(int $verbosity): array + { + $response = [ + 'success' => $this->success, + 'execution_time_ms' => $this->executionTime, + 'search' => $this->search->toArray(), + ]; + + if ($verbosity >= self::VERBOSITY_VERBOSE) { + $response['response'] = $this->response; + } + + if ($verbosity >= self::VERBOSITY_VERY_VERBOSE) { + $response['stackTrace'] = $this->stackTrace; + } + + return $response; + } +} diff --git a/src/Model/DefaultSearch/DefaultSearchInterface.php b/src/Model/DefaultSearch/DefaultSearchInterface.php new file mode 100644 index 00000000..f7670f0c --- /dev/null +++ b/src/Model/DefaultSearch/DefaultSearchInterface.php @@ -0,0 +1,45 @@ +search; + } + + public function getOriginalSearch(): SearchInterface + { + return $this->originalSearch; + } +} diff --git a/src/Model/DefaultSearch/Modifier/SearchModifierContextInterface.php b/src/Model/DefaultSearch/Modifier/SearchModifierContextInterface.php new file mode 100644 index 00000000..4144e253 --- /dev/null +++ b/src/Model/DefaultSearch/Modifier/SearchModifierContextInterface.php @@ -0,0 +1,33 @@ +toArray()); + } + + public function getParams(): array + { + return $this->params; + } + + public function addCondition(string $type, array $params): BoolQuery + { + $this->params[$type] = $this->params[$type] ?? []; + if (!empty($this->params[$type]) && !array_is_list($this->params[$type])) { + $this->params[$type] = [$this->params[$type]]; + } + if (array_is_list($params)) { + $this->params[$type] = array_merge($this->params[$type], $params); + } else { + $this->params[$type][] = $params; + } + + return $this; + } + + public function merge(BoolQuery $boolQuery): BoolQuery + { + foreach ($boolQuery->toArray() as $type => $params) { + $this->addCondition($type, $params); + } + + return $this; + } + + public function toArray(bool $withType = false): array + { + $result = $this->convertQueryObjectsToArray($this->getParams()); + $result = $this->simplifySingleTypes($result); + + if ($withType) { + return [$this->getType()->value => $result]; + } + + return $result; + } +} diff --git a/src/Model/DefaultSearch/Query/DateFilter.php b/src/Model/DefaultSearch/Query/DateFilter.php new file mode 100644 index 00000000..d03dc31f --- /dev/null +++ b/src/Model/DefaultSearch/Query/DateFilter.php @@ -0,0 +1,187 @@ +startDate = is_int($startTimestamp) ? Carbon::createFromTimestamp($startTimestamp) : $startTimestamp; + $this->endDate = is_int($endTimestamp) ? Carbon::createFromTimestamp($endTimestamp) : $endTimestamp; + $this->onDate = is_int($onTimestamp) ? Carbon::createFromTimestamp($onTimestamp) : $onTimestamp; + } + + public static function createFromArray(string $field, array $params, bool $roundToDay = true): DateFilter + { + $allowedParams = [ + self::PARAM_END, + self::PARAM_START, + self::PARAM_ON, + ]; + + if (count(array_diff(array_keys($params), $allowedParams)) > 0) { + throw new InvalidArgumentException( + sprintf( + 'Invalid parameters for date filter (only %s are allowed): %s', + implode(', ', $allowedParams), + implode(', ', array_diff(array_keys($params), $allowedParams)) + ) + ); + } + + foreach ($params as $key => $value) { + if (!is_int($value)) { + throw new InvalidArgumentException( + sprintf( + 'Invalid value for parameter %s, expected integer, got %s', + $key, + gettype($value) + ) + ); + } + } + + return new self( + $field, + $params[self::PARAM_START] ?? null, + $params[self::PARAM_END] ?? null, + $params[self::PARAM_ON] ?? null, + $roundToDay + ); + } + + public function getType(): QueryType|string + { + return 'range'; + } + + public function isEmpty(): bool + { + return empty($this->getParams()); + } + + public function getParams(): array + { + $params = [ + 'format' => "yyyy-MM-dd'T'HH:mm:ssz", + ]; + if ($this->onDate) { + $params['gte'] = $this->getStartOfDay($this->onDate)->format(DateTimeInterface::ATOM); + $params['lte'] = $this->getEndOfDay($this->onDate)->format(DateTimeInterface::ATOM); + } else { + if ($this->startDate) { + $params['gte'] = $this->getStartOfDay($this->startDate)->format(DateTimeInterface::ATOM); + } + if ($this->endDate) { + $params['lte'] = $this->getEndOfDay($this->endDate)->format(DateTimeInterface::ATOM); + } + } + + return [ + $this->field => $params, + ]; + } + + public function toArray(bool $withType = false): array + { + if ($withType) { + return [$this->getType() => $this->getParams()]; + } + + return $this->getParams(); + } + + public function getField(): string + { + return $this->field; + } + + public function getEndTimestamp(): ?int + { + return $this->endDate->getTimestamp(); + } + + public function getStartTimestamp(): ?int + { + return $this->startDate->getTimestamp(); + } + + public function getOnTimestamp(): ?int + { + return $this->onDate->getTimestamp(); + } + + public function getEndDate(): Carbon + { + return $this->endDate; + } + + public function getStartDate(): Carbon + { + return $this->startDate; + } + + public function getOnDate(): Carbon + { + return $this->onDate; + } + + private function getStartOfDay(Carbon $date): Carbon + { + if (!$this->roundToDay) { + return $date; + } + + return $date->startOfDay(); + } + + private function getEndOfDay(Carbon $date): Carbon + { + if (!$this->roundToDay) { + return $date; + } + + return $date->endOfDay(); + } + + public function isRoundToDay(): bool + { + return $this->roundToDay; + } +} diff --git a/src/Model/DefaultSearch/Query/Query.php b/src/Model/DefaultSearch/Query/Query.php new file mode 100644 index 00000000..44d24c86 --- /dev/null +++ b/src/Model/DefaultSearch/Query/Query.php @@ -0,0 +1,54 @@ +type; + } + + public function isEmpty(): bool + { + return empty($this->params); + } + + public function getParams(): array + { + return $this->params; + } + + public function toArray(bool $withType = false): array + { + if ($withType) { + return [$this->type => $this->getParams()]; + } + + return $this->getParams(); + } +} diff --git a/src/Model/DefaultSearch/Query/QueryInterface.php b/src/Model/DefaultSearch/Query/QueryInterface.php new file mode 100644 index 00000000..e4b1e0c6 --- /dev/null +++ b/src/Model/DefaultSearch/Query/QueryInterface.php @@ -0,0 +1,30 @@ +isEmpty()) { + if ($this->boolQuery !== null) { + $this->boolQuery->merge($query); + + return $this; + } + $this->boolQuery = $query; + } + + if ($query !== null && !$query->isEmpty()) { + $this->queries[] = $query; + } + + return $this; + } + + public function isEmpty(): bool + { + return empty($this->queries); + } + + public function toArray(): array + { + $result = []; + + $this->combineToBoolQuery(); + + foreach ($this->queries as $query) { + $queryType = $query->getType() instanceof QueryType ? $query->getType()->value : $query->getType(); + $result[$queryType] = $result[$queryType] ?? []; + $result[$queryType][] = $query->toArray(); + } + + return $this->simplifySingleTypes($result); + } + + private function combineToBoolQuery(): void + { + if (count($this->queries) < 2) { + return; + } + + $this->boolQuery ??= new BoolQuery(); + + foreach ($this->queries as $query) { + if (!$query instanceof BoolQuery && !$query->isEmpty()) { + $this->boolQuery->addCondition(ConditionType::FILTER->value, $query->toArray(true)); + } + } + $this->queries = [$this->boolQuery]; + } +} diff --git a/src/Model/DefaultSearch/Query/SimpleQueryStringFilter.php b/src/Model/DefaultSearch/Query/SimpleQueryStringFilter.php new file mode 100644 index 00000000..ae7d6ae0 --- /dev/null +++ b/src/Model/DefaultSearch/Query/SimpleQueryStringFilter.php @@ -0,0 +1,48 @@ +value => [ + 'simple_query_string' => [ + 'query' => $this->term, + ], + ], + ]); + } + + public function getTerm(): string + { + return $this->term; + } + + public function toArrayAsSubQuery(): array + { + return [ + 'simple_query_string' => [ + 'query' => $this->term, + ], + ]; + } +} diff --git a/src/Model/DefaultSearch/Query/TermFilter.php b/src/Model/DefaultSearch/Query/TermFilter.php new file mode 100644 index 00000000..00e47b98 --- /dev/null +++ b/src/Model/DefaultSearch/Query/TermFilter.php @@ -0,0 +1,54 @@ +value => [ + 'term' => [ + $this->field => $this->term, + ], + ], + ]); + } + + public function getField(): string + { + return $this->field; + } + + public function getTerm(): string|int|bool + { + return $this->term; + } + + public function toArrayAsSubQuery(): array + { + return [ + 'term' => [ + $this->field => $this->term, + ], + ]; + } +} diff --git a/src/Model/DefaultSearch/Query/TermsFilter.php b/src/Model/DefaultSearch/Query/TermsFilter.php new file mode 100644 index 00000000..27e246f1 --- /dev/null +++ b/src/Model/DefaultSearch/Query/TermsFilter.php @@ -0,0 +1,56 @@ +value => [ + 'terms' => [ + $this->field => $this->terms, + ], + ], + ]); + } + + public function getField(): string + { + return $this->field; + } + + /** @return (int|string)[] */ + public function getTerms(): array + { + return $this->terms; + } + + public function toArrayAsSubQuery(): array + { + return [ + 'terms' => [ + $this->field => $this->terms, + ], + ]; + } +} diff --git a/src/Model/DefaultSearch/Query/WildcardFilter.php b/src/Model/DefaultSearch/Query/WildcardFilter.php new file mode 100644 index 00000000..488817f8 --- /dev/null +++ b/src/Model/DefaultSearch/Query/WildcardFilter.php @@ -0,0 +1,78 @@ +value => $this->getWildcardQueryArray(), + ]); + } + + public function getField(): string + { + return $this->field; + } + + public function getTerm(): string + { + return $this->term; + } + + public function isCaseInsensitive(): bool + { + return $this->caseInsensitive; + } + + public function toArrayAsSubQuery(): array + { + return $this->getWildcardQueryArray(); + } + + private function getWildcardQueryArray(): array + { + $term = $this->term; + + if ($term !== '' && !str_contains($term, '*')) { + if ($this->defaultWildcardMode === WildcardFilterMode::BOTH) { + $term = "*$term*"; + } elseif ($this->defaultWildcardMode === WildcardFilterMode::PREFIX) { + $term = "*$term"; + } elseif ($this->defaultWildcardMode === WildcardFilterMode::SUFFIX) { + $term = "$term*"; + } + } + + return [ + 'wildcard' => [ + $this->field => [ + 'value' => $term, + 'case_insensitive' => $this->caseInsensitive, + ], + ], + ]; + } +} diff --git a/src/Model/DefaultSearch/Search.php b/src/Model/DefaultSearch/Search.php new file mode 100644 index 00000000..6091c399 --- /dev/null +++ b/src/Model/DefaultSearch/Search.php @@ -0,0 +1,171 @@ +from; + } + + public function setFrom(?int $from): DefaultSearchInterface + { + $this->from = $from; + + return $this; + } + + public function getSize(): ?int + { + return $this->size; + } + + public function setSize(?int $size): DefaultSearchInterface + { + $this->size = $size; + + return $this; + } + + public function getSource(): bool|array|string|null + { + return $this->source; + } + + public function setSource(bool|array|string|null $source): DefaultSearchInterface + { + $this->source = $source; + + return $this; + } + + public function addQuery(QueryInterface $query = null): DefaultSearchInterface + { + $this->queryList->addQuery($query); + + return $this; + } + + public function addSort(FieldSort $sort): DefaultSearchInterface + { + $this->sortList->addSort($sort); + + return $this; + } + + public function addAggregation(Aggregation $aggregation): DefaultSearchInterface + { + $this->aggregationList->addAggregation($aggregation); + + return $this; + } + + public function getQueryList(): QueryList + { + return $this->queryList; + } + + public function getSortList(): FieldSortList + { + return $this->sortList; + } + + public function setSortList(FieldSortList $sortList): DefaultSearchInterface + { + $this->sortList = $sortList; + + return $this; + } + + public function isReverseItemOrder(): bool + { + return $this->reverseItemOrder; + } + + public function setReverseItemOrder(bool $reverseItemOrder): DefaultSearchInterface + { + $this->reverseItemOrder = $reverseItemOrder; + + return $this; + } + + public function getSearchAfter(): ?array + { + return $this->searchAfter; + } + + public function setSearchAfter(?array $searchAfter): DefaultSearchInterface + { + $this->searchAfter = is_array($searchAfter) && !empty($searchAfter) ? $searchAfter : null; + + return $this; + } + + public function toArray(): array + { + $result = [ + 'from' => $this->getSearchAfter() !== null ? null : $this->from, + 'size' => $this->size, + '_source' => $this->source, + ]; + + foreach ($result as $key => $value) { + if ($value === null) { + unset($result[$key]); + } + } + + if (!$this->queryList->isEmpty()) { + $result['query'] = $this->queryList->toArray(); + } + + if (!$this->aggregationList->isEmpty()) { + $result['aggs'] = $this->aggregationList->toArray(); + } + + if (!$this->sortList->isEmpty()) { + $result['sort'] = $this->sortList->toArray(); + } + + if ($this->getSearchAfter() !== null) { + $result['search_after'] = $this->getSearchAfter(); + } + + return $result; + } +} diff --git a/src/Model/DefaultSearch/Sort/FieldSort.php b/src/Model/DefaultSearch/Sort/FieldSort.php new file mode 100644 index 00000000..38136557 --- /dev/null +++ b/src/Model/DefaultSearch/Sort/FieldSort.php @@ -0,0 +1,78 @@ +field; + } + + public function setField(string $field): FieldSort + { + $this->field = $field; + + return $this; + } + + public function getOrder(): string + { + return $this->order; + } + + public function setOrder(?string $order): FieldSort + { + $this->order = $order; + + return $this; + } + + public function getParams(): array + { + return $this->params; + } + + public function setParams(array $params): FieldSort + { + $this->params = $params; + + return $this; + } + + public function toArray(): array + { + if ($this->order) { + $this->params['order'] = $this->order; + } + + return [ + $this->field => $this->params, + ]; + } +} diff --git a/src/Model/DefaultSearch/Sort/FieldSortList.php b/src/Model/DefaultSearch/Sort/FieldSortList.php new file mode 100644 index 00000000..6265be12 --- /dev/null +++ b/src/Model/DefaultSearch/Sort/FieldSortList.php @@ -0,0 +1,56 @@ +sort[] = $sort; + } + + return $this; + } + + public function getSort(): array + { + return $this->sort; + } + + public function isEmpty(): bool + { + return empty($this->sort); + } + + public function toArray(): array + { + $result = []; + + foreach ($this->sort as $sort) { + $result[] = $sort->toArray(); + } + + return count($result) === 1 ? reset($result) : $result; + } +} diff --git a/src/Model/DefaultSearch/Traits/QueryObjectsToArrayTrait.php b/src/Model/DefaultSearch/Traits/QueryObjectsToArrayTrait.php new file mode 100644 index 00000000..63d0608a --- /dev/null +++ b/src/Model/DefaultSearch/Traits/QueryObjectsToArrayTrait.php @@ -0,0 +1,39 @@ +toArrayAsSubQuery(); + } elseif ($value instanceof QueryInterface) { + $value = $value->toArray(true); + } + } + ); + + return $params; + } +} diff --git a/src/Model/DefaultSearch/Traits/SimplifySingleTypesTrait.php b/src/Model/DefaultSearch/Traits/SimplifySingleTypesTrait.php new file mode 100644 index 00000000..ee56f085 --- /dev/null +++ b/src/Model/DefaultSearch/Traits/SimplifySingleTypesTrait.php @@ -0,0 +1,31 @@ + $items) { + if (array_is_list($items) && count($items) === 1) { + $queries[$queryType] = reset($items); + } + } + + return $queries; + } +} diff --git a/src/Model/OpenSearch/Aggregation/Aggregation.php b/src/Model/OpenSearch/Aggregation/Aggregation.php index d560c9db..123b4dcf 100644 --- a/src/Model/OpenSearch/Aggregation/Aggregation.php +++ b/src/Model/OpenSearch/Aggregation/Aggregation.php @@ -16,6 +16,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation instead + */ final readonly class Aggregation { public function __construct( diff --git a/src/Model/OpenSearch/Aggregation/AggregationList.php b/src/Model/OpenSearch/Aggregation/AggregationList.php index 3b334d6c..efbeeb3b 100644 --- a/src/Model/OpenSearch/Aggregation/AggregationList.php +++ b/src/Model/OpenSearch/Aggregation/AggregationList.php @@ -16,6 +16,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\AggregationList instead + */ final class AggregationList { public function __construct( diff --git a/src/Model/OpenSearch/Debug/SearchInformation.php b/src/Model/OpenSearch/Debug/SearchInformation.php index 7054ac65..a2304ead 100644 --- a/src/Model/OpenSearch/Debug/SearchInformation.php +++ b/src/Model/OpenSearch/Debug/SearchInformation.php @@ -20,12 +20,16 @@ /** * @internal + * + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Debug\SearchInformation instead + * / */ final class SearchInformation { - private const VERBOSITY_VERBOSE = 2; + public const VERBOSITY_VERBOSE = 2; - private const VERBOSITY_VERY_VERBOSE = 3; + public const VERBOSITY_VERY_VERBOSE = 3; public function __construct( private readonly AdapterSearchInterface $search, diff --git a/src/Model/OpenSearch/Modifier/SearchModifierContext.php b/src/Model/OpenSearch/Modifier/SearchModifierContext.php index c771f95e..d08ed2ee 100644 --- a/src/Model/OpenSearch/Modifier/SearchModifierContext.php +++ b/src/Model/OpenSearch/Modifier/SearchModifierContext.php @@ -19,6 +19,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContext instead + */ readonly class SearchModifierContext implements SearchModifierContextInterface { public function __construct( diff --git a/src/Model/OpenSearch/Modifier/SearchModifierContextInterface.php b/src/Model/OpenSearch/Modifier/SearchModifierContextInterface.php index d5125faa..13b25eb2 100644 --- a/src/Model/OpenSearch/Modifier/SearchModifierContextInterface.php +++ b/src/Model/OpenSearch/Modifier/SearchModifierContextInterface.php @@ -19,6 +19,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface instead + */ interface SearchModifierContextInterface { /** diff --git a/src/Model/OpenSearch/OpenSearchSearchInterface.php b/src/Model/OpenSearch/OpenSearchSearchInterface.php index 01e7fe4c..7f16690c 100644 --- a/src/Model/OpenSearch/OpenSearchSearchInterface.php +++ b/src/Model/OpenSearch/OpenSearchSearchInterface.php @@ -16,14 +16,17 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\QueryInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\QueryList; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSort; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; /** * @internal + * + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\DefaultSearchInterface instead */ interface OpenSearchSearchInterface extends AdapterSearchInterface { diff --git a/src/Model/OpenSearch/Query/AsSubQueryInterface.php b/src/Model/OpenSearch/Query/AsSubQueryInterface.php index edc6fa2c..7c972598 100644 --- a/src/Model/OpenSearch/Query/AsSubQueryInterface.php +++ b/src/Model/OpenSearch/Query/AsSubQueryInterface.php @@ -16,6 +16,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\AsSubQueryInterface instead + */ interface AsSubQueryInterface { public function toArrayAsSubQuery(): array; diff --git a/src/Model/OpenSearch/Query/BoolQuery.php b/src/Model/OpenSearch/Query/BoolQuery.php index cc5852ae..ffb35917 100644 --- a/src/Model/OpenSearch/Query/BoolQuery.php +++ b/src/Model/OpenSearch/Query/BoolQuery.php @@ -20,6 +20,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Traits\QueryObjectsToArrayTrait; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Traits\SimplifySingleTypesTrait; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery instead + */ class BoolQuery implements QueryInterface { use SimplifySingleTypesTrait; diff --git a/src/Model/OpenSearch/Query/DateFilter.php b/src/Model/OpenSearch/Query/DateFilter.php index c9a0a87c..86ba113b 100644 --- a/src/Model/OpenSearch/Query/DateFilter.php +++ b/src/Model/OpenSearch/Query/DateFilter.php @@ -21,6 +21,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\QueryType; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter instead + */ final readonly class DateFilter implements QueryInterface { public const PARAM_START = 'start'; diff --git a/src/Model/OpenSearch/Query/Query.php b/src/Model/OpenSearch/Query/Query.php index 4c5bb2fb..0985d27c 100644 --- a/src/Model/OpenSearch/Query/Query.php +++ b/src/Model/OpenSearch/Query/Query.php @@ -18,6 +18,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Traits\QueryObjectsToArrayTrait; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\Query instead + */ final class Query implements QueryInterface { use QueryObjectsToArrayTrait; diff --git a/src/Model/OpenSearch/Query/QueryInterface.php b/src/Model/OpenSearch/Query/QueryInterface.php index df486a0c..00b6df9a 100644 --- a/src/Model/OpenSearch/Query/QueryInterface.php +++ b/src/Model/OpenSearch/Query/QueryInterface.php @@ -18,6 +18,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\QueryType; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\QueryInterface instead + */ interface QueryInterface { public function getType(): QueryType|string; diff --git a/src/Model/OpenSearch/Query/QueryList.php b/src/Model/OpenSearch/Query/QueryList.php index 9cdfbcb0..56eac472 100644 --- a/src/Model/OpenSearch/Query/QueryList.php +++ b/src/Model/OpenSearch/Query/QueryList.php @@ -20,6 +20,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\QueryType; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Traits\SimplifySingleTypesTrait; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\QueryList instead + */ final class QueryList { use SimplifySingleTypesTrait; diff --git a/src/Model/OpenSearch/Query/SimpleQueryStringFilter.php b/src/Model/OpenSearch/Query/SimpleQueryStringFilter.php index c7b48c9d..2785f49b 100644 --- a/src/Model/OpenSearch/Query/SimpleQueryStringFilter.php +++ b/src/Model/OpenSearch/Query/SimpleQueryStringFilter.php @@ -18,6 +18,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\SimpleQueryStringFilter instead + */ final class SimpleQueryStringFilter extends BoolQuery implements AsSubQueryInterface { public function __construct( diff --git a/src/Model/OpenSearch/Query/TermFilter.php b/src/Model/OpenSearch/Query/TermFilter.php index 9bb02787..f224e353 100644 --- a/src/Model/OpenSearch/Query/TermFilter.php +++ b/src/Model/OpenSearch/Query/TermFilter.php @@ -18,6 +18,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter instead + */ final class TermFilter extends BoolQuery implements AsSubQueryInterface { public function __construct( diff --git a/src/Model/OpenSearch/Query/TermsFilter.php b/src/Model/OpenSearch/Query/TermsFilter.php index 351d9a19..650aff91 100644 --- a/src/Model/OpenSearch/Query/TermsFilter.php +++ b/src/Model/OpenSearch/Query/TermsFilter.php @@ -18,6 +18,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermsFilter instead + */ final class TermsFilter extends BoolQuery implements AsSubQueryInterface { public function __construct( diff --git a/src/Model/OpenSearch/Query/WildcardFilter.php b/src/Model/OpenSearch/Query/WildcardFilter.php index 47e22a22..31a2d46f 100644 --- a/src/Model/OpenSearch/Query/WildcardFilter.php +++ b/src/Model/OpenSearch/Query/WildcardFilter.php @@ -19,6 +19,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\WildcardFilterMode; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\WildcardFilter instead + */ final class WildcardFilter extends BoolQuery implements AsSubQueryInterface { public function __construct( diff --git a/src/Model/OpenSearch/Search.php b/src/Model/OpenSearch/Search.php index 51364a66..32982c68 100644 --- a/src/Model/OpenSearch/Search.php +++ b/src/Model/OpenSearch/Search.php @@ -16,13 +16,17 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSortList; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\AggregationList; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\QueryInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\QueryList; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSort; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSortList; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search instead + */ final class Search implements OpenSearchSearchInterface { public function __construct( diff --git a/src/Model/OpenSearch/Sort/FieldSort.php b/src/Model/OpenSearch/Sort/FieldSort.php index 59d4fd4c..22f60b6d 100644 --- a/src/Model/OpenSearch/Sort/FieldSort.php +++ b/src/Model/OpenSearch/Sort/FieldSort.php @@ -16,6 +16,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort instead + */ final class FieldSort { public const ORDER_ASC = 'asc'; diff --git a/src/Model/OpenSearch/Sort/FieldSortList.php b/src/Model/OpenSearch/Sort/FieldSortList.php index 6681357a..d9ee20eb 100644 --- a/src/Model/OpenSearch/Sort/FieldSortList.php +++ b/src/Model/OpenSearch/Sort/FieldSortList.php @@ -16,6 +16,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSortList instead + */ final class FieldSortList { public function __construct( diff --git a/src/Model/OpenSearch/Traits/QueryObjectsToArrayTrait.php b/src/Model/OpenSearch/Traits/QueryObjectsToArrayTrait.php index e7aca418..e742c29c 100644 --- a/src/Model/OpenSearch/Traits/QueryObjectsToArrayTrait.php +++ b/src/Model/OpenSearch/Traits/QueryObjectsToArrayTrait.php @@ -19,6 +19,10 @@ use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\AsSubQueryInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\QueryInterface; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Traits\QueryObjectsToArrayTrait instead + */ trait QueryObjectsToArrayTrait { private function convertQueryObjectsToArray(array $params): array diff --git a/src/Model/OpenSearch/Traits/SimplifySingleTypesTrait.php b/src/Model/OpenSearch/Traits/SimplifySingleTypesTrait.php index b4223533..5f2df569 100644 --- a/src/Model/OpenSearch/Traits/SimplifySingleTypesTrait.php +++ b/src/Model/OpenSearch/Traits/SimplifySingleTypesTrait.php @@ -16,6 +16,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Traits; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Traits\SimplifySingleTypesTrait instead + */ trait SimplifySingleTypesTrait { private function simplifySingleTypes(array $queries): array diff --git a/src/Model/Search/Interfaces/AdapterSearchInterface.php b/src/Model/Search/Interfaces/AdapterSearchInterface.php index 3d6d427f..83257b66 100644 --- a/src/Model/Search/Interfaces/AdapterSearchInterface.php +++ b/src/Model/Search/Interfaces/AdapterSearchInterface.php @@ -16,8 +16,7 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSortList; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSortList; interface AdapterSearchInterface { @@ -31,11 +30,11 @@ public function setSize(?int $size): AdapterSearchInterface; public function getSortList(): FieldSortList; - public function setSortList(FieldSortList $sortList): OpenSearchSearchInterface; + public function setSortList(FieldSortList $sortList): AdapterSearchInterface; public function isReverseItemOrder(): bool; - public function setReverseItemOrder(bool $reverseItemOrder): OpenSearchSearchInterface; + public function setReverseItemOrder(bool $reverseItemOrder): AdapterSearchInterface; public function toArray(): array; } diff --git a/src/PimcoreGenericDataIndexBundle.php b/src/PimcoreGenericDataIndexBundle.php index 09f5e277..956fd5c4 100644 --- a/src/PimcoreGenericDataIndexBundle.php +++ b/src/PimcoreGenericDataIndexBundle.php @@ -16,7 +16,9 @@ namespace Pimcore\Bundle\GenericDataIndexBundle; +use Pimcore\Bundle\ElasticsearchClientBundle\PimcoreElasticsearchClientBundle; use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler as SearchModifierHandler; use Pimcore\Bundle\GenericDataIndexBundle\DependencyInjection\Compiler\SearchModifierHandlerPass; use Pimcore\Bundle\GenericDataIndexBundle\DependencyInjection\Compiler\ServiceLocatorPass; use Pimcore\Bundle\GenericDataIndexBundle\Enum\DependencyInjection\ServiceTag; @@ -61,12 +63,27 @@ public function getInstaller(): ?InstallerInterface public static function registerDependentBundles(BundleCollection $collection): void { + $collection->addBundle(new PimcoreElasticsearchClientBundle()); $collection->addBundle(new PimcoreOpenSearchClientBundle()); $collection->addBundle(new PimcoreStaticResolverBundle()); } private function registerSearchModifierAttribute(ContainerBuilder $container): void { + $container->registerAttributeForAutoconfiguration( + SearchModifierHandler::class, + static function ( + ChildDefinition $definition, + SearchModifierHandler $attribute, + Reflector $reflector + ): void { + self::configureSearchModifierHandler($definition, $reflector); + } + ); + + /** + * @TODO Remove this in version 2.0 + */ $container->registerAttributeForAutoconfiguration( AsSearchModifierHandler::class, static function ( @@ -74,15 +91,21 @@ static function ( AsSearchModifierHandler $attribute, Reflector $reflector ): void { - - $method = ($reflector instanceof ReflectionMethod) - ? $reflector->getName() - : '__invoke'; - - $definition->addTag(ServiceTag::SEARCH_MODIFIER_HANDLER->value, [ - 'method' => $method, - ]); + self::configureSearchModifierHandler($definition, $reflector); } ); } + + private static function configureSearchModifierHandler( + ChildDefinition $definition, + Reflector $reflector + ): void { + $method = ($reflector instanceof ReflectionMethod) + ? $reflector->getName() + : '__invoke'; + + $definition->addTag(ServiceTag::SEARCH_MODIFIER_HANDLER->value, [ + 'method' => $method, + ]); + } } diff --git a/src/SearchIndexAdapter/Asset/AdapterInterface.php b/src/SearchIndexAdapter/Asset/AdapterInterface.php index cc45d057..3c648352 100644 --- a/src/SearchIndexAdapter/Asset/AdapterInterface.php +++ b/src/SearchIndexAdapter/Asset/AdapterInterface.php @@ -17,7 +17,7 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Asset; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Aggregation\Asset\AssetMetaDataAggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; diff --git a/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php new file mode 100644 index 00000000..76f6d718 --- /dev/null +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php @@ -0,0 +1,144 @@ +type = $type; + + return $this; + } + + public function getType(): string + { + return $this->type; + } + + abstract public function getIndexMapping(): array; + + public function normalize(mixed $value): mixed + { + return $value; + } + + /** + * @param DefaultSearchInterface $adapterSearch + * + * @throws InvalidArgumentException + */ + public function applySearchFilter(AssetMetaDataFilter $filter, AdapterSearchInterface $adapterSearch): void + { + if ($filter->getType() !== $this->getType()) { + throw new InvalidArgumentException( + sprintf( + '%s does not support filter type "%s" for filter "%s"', + static::class, + $filter->getType(), + $filter->getName() + ) + ); + } + + $value = $filter->getData(); + + $query = null; + if ($this->isValidScalar($value)) { + $query = new TermFilter($this->getSearchFilterFieldPath($filter), $value); + } elseif (is_array($value)) { + try { + $this->validateArray($value); + } catch (ValueError) { + $this->throwInvalidFilterValueArgumentException($value, $filter); + } + $value = array_unique($value); + $query = new TermsFilter($this->getSearchFilterFieldPath($filter), $value); + } + + if ($query === null) { + $this->throwInvalidFilterValueArgumentException($value, $filter); + } + + $adapterSearch->addQuery( + $query + ); + } + + public function getSearchFilterAggregation(AssetMetaDataAggregation $aggregation): ?Aggregation + { + return null; + } + + protected function isValidScalar(mixed $value): bool + { + return is_string($value); + } + + /** + * @throws ValueError + */ + protected function validateArray(array $value): void + { + new ArrayOfStrings($value); + } + + protected function getSearchFilterFieldPath(AssetMetaDataFilter|AssetMetaDataAggregation $filter): string + { + return implode('.', [ + FieldCategory::STANDARD_FIELDS->value, + $filter->getName(), + $filter->getLanguage() ?? MappingProperty::NOT_LOCALIZED_KEY, + ]); + } + + /** + * @throws InvalidArgumentException + */ + protected function throwInvalidFilterValueArgumentException(mixed $value, AssetMetaDataFilter $filter): void + { + throw new InvalidArgumentException( + sprintf( + 'Unsupported value type "%s" for filter "%s"', + gettype($value), + $filter->getName() + ) + ); + } +} diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/BooleanAdapter.php b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/BooleanAdapter.php similarity index 88% rename from src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/BooleanAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/BooleanAdapter.php index 05ac5731..23d667fa 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/BooleanAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/BooleanAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\ValueObject\Collection\ArrayOfBoolean; /** diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/DateAdapter.php b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/DateAdapter.php similarity index 88% rename from src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/DateAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/DateAdapter.php index ba8d2034..250163b2 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/DateAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/DateAdapter.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter; use Carbon\Carbon; use DateTimeInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\DateFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/KeywordAdapter.php b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/KeywordAdapter.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/KeywordAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/KeywordAdapter.php index a6ae19f7..19bfa2bf 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/KeywordAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/KeywordAdapter.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Aggregation\Asset\AssetMetaDataAggregation; /** diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/RelationAdapter.php b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/RelationAdapter.php similarity index 93% rename from src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/RelationAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/RelationAdapter.php index e64baa88..e3b6d82e 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/RelationAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/RelationAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Aggregation\Asset\AssetMetaDataAggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; use Pimcore\Model\Element\ElementInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/TextKeywordAdapter.php b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/TextKeywordAdapter.php similarity index 95% rename from src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/TextKeywordAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/TextKeywordAdapter.php index 412f024a..4c8b3822 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/TextKeywordAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionAdapter/TextKeywordAdapter.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\WildcardFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\WildcardFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Aggregation\Asset\AssetMetaDataAggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionService.php b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionService.php similarity index 98% rename from src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionService.php rename to src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionService.php index 458cdf10..744c4916 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/FieldDefinitionService.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Asset\AdapterInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Asset\FieldDefinitionServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/PredefinedAssetMetadataProvider.php b/src/SearchIndexAdapter/DefaultSearch/Asset/PredefinedAssetMetadataProvider.php similarity index 99% rename from src/SearchIndexAdapter/OpenSearch/Asset/PredefinedAssetMetadataProvider.php rename to src/SearchIndexAdapter/DefaultSearch/Asset/PredefinedAssetMetadataProvider.php index a18f80c1..74305e62 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/PredefinedAssetMetadataProvider.php +++ b/src/SearchIndexAdapter/DefaultSearch/Asset/PredefinedAssetMetadataProvider.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\MappingProperty; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Asset\FieldDefinitionServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/BulkOperationService.php b/src/SearchIndexAdapter/DefaultSearch/BulkOperationService.php similarity index 92% rename from src/SearchIndexAdapter/OpenSearch/BulkOperationService.php rename to src/SearchIndexAdapter/DefaultSearch/BulkOperationService.php index 5b206b79..3ed798c7 100644 --- a/src/SearchIndexAdapter/OpenSearch/BulkOperationService.php +++ b/src/SearchIndexAdapter/DefaultSearch/BulkOperationService.php @@ -14,17 +14,16 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; use Exception; -use OpenSearch\Client; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\RefreshIndexMode; use Pimcore\Bundle\GenericDataIndexBundle\Exception\BulkOperationException; use Pimcore\Bundle\GenericDataIndexBundle\Exception\IndexModeException; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\BulkOperationServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexQueue\SynchronousProcessingServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Traits\LoggerAwareTrait; -use RuntimeException; +use Pimcore\SearchClient\SearchClientInterface; /** * @internal @@ -36,7 +35,7 @@ final class BulkOperationService implements BulkOperationServiceInterface private array $bulkOperationData = []; public function __construct( - private readonly Client $openSearchClient, + private readonly SearchClientInterface $client, private readonly SynchronousProcessingServiceInterface $synchronousProcessing ) { } @@ -85,7 +84,7 @@ public function commit(?string $refreshIndex = null): void try { $this->logger->info('Commit bulk to index.'); - $response = $this->openSearchClient->bulk( + $response = $this->client->bulk( $this->prepareBulkParams($refreshIndex) ); @@ -94,8 +93,8 @@ public function commit(?string $refreshIndex = null): void if ($response['errors'] ?? true) { $responseEncoded = json_encode($response, JSON_THROW_ON_ERROR); - throw new RuntimeException( - 'OpenSearch bulk produced errors: '. $responseEncoded + throw new BulkOperationException( + 'Bulk operation produced errors: '. $responseEncoded ); } } catch (Exception $e) { diff --git a/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php new file mode 100644 index 00000000..dfb27894 --- /dev/null +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php @@ -0,0 +1,67 @@ +fieldDefinition = $fieldDefinition; + + return $this; + } + + public function getFieldDefinition(): Data + { + return $this->fieldDefinition; + } + + public function getIndexAttributeName(): string + { + return $this->fieldDefinition->getName(); + } + + public function getFieldDefinitionService(): FieldDefinitionServiceInterface + { + return $this->fieldDefinitionService; + } + + public function normalize(mixed $value): mixed + { + if ($this->fieldDefinition instanceof NormalizerInterface) { + return $this->fieldDefinition->normalize($value); + } + + return $value; + } +} diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AdvancedImageAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AdvancedImageAdapter.php similarity index 94% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AdvancedImageAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AdvancedImageAdapter.php index b58a7e7e..c84dc6b8 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AdvancedImageAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AdvancedImageAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapter.php similarity index 89% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapter.php index 18e9aa15..6ece6658 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapter.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Model\DataObject\ClassDefinition\Data\AdvancedManyToManyObjectRelation; use Pimcore\Model\DataObject\ClassDefinition\Data\AdvancedManyToManyRelation; use Pimcore\Normalizer\NormalizerInterface; @@ -84,14 +84,11 @@ private function getColumnDefinition(array $columns): array $type = []; foreach ($columns as $column) { if (isset($column['type'], $column['key'])) { - match ($column['type']) { - 'number' => $type[$column['key']] = [ - 'type' => AttributeType::LONG, - ], - default => $type[$column['key']] = [ - 'type' => AttributeType::KEYWORD, - ] + $value = match ($column['type']) { + 'number' => ['type' => AttributeType::LONG], + default => ['type' => AttributeType::KEYWORD], }; + $type[$column['key']] = $value; } } diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/BlockAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/BlockAdapter.php similarity index 97% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/BlockAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/BlockAdapter.php index 4e8bda82..277058df 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/BlockAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/BlockAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use InvalidArgumentException; use Pimcore\Model\DataObject\ClassDefinition\Data\Block; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/BooleanAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/BooleanAdapter.php similarity index 84% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/BooleanAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/BooleanAdapter.php index ac2d5990..eafdf193 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/BooleanAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/BooleanAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php similarity index 98% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php index 634039c9..21f6e0a9 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Exception; use InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\MappingProperty; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\LanguageServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Traits\LoggerAwareTrait; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ConsentAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ConsentAdapter.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ConsentAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ConsentAdapter.php index 8dd06236..5cbc7c84 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ConsentAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ConsentAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DateAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DateAdapter.php similarity index 91% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DateAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DateAdapter.php index 9f20d246..af1e4fb2 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DateAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DateAdapter.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Carbon\Carbon; use DateTimeInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Model\DataObject\ClassDefinition\Data\Date; /** diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DateRangeAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DateRangeAdapter.php similarity index 92% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DateRangeAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DateRangeAdapter.php index 4c48c8b7..33e92793 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DateRangeAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DateRangeAdapter.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Carbon\CarbonInterface; use Carbon\CarbonPeriod; use DateTimeInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DatetimeAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DatetimeAdapter.php similarity index 91% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DatetimeAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DatetimeAdapter.php index 90ef1c1a..01bcb2cc 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/DatetimeAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/DatetimeAdapter.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Carbon\Carbon; use DateTimeInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Model\DataObject\ClassDefinition\Data\Datetime; /** diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ExternalImageAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ExternalImageAdapter.php similarity index 85% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ExternalImageAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ExternalImageAdapter.php index 312ce3d5..ad38a30b 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ExternalImageAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ExternalImageAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/FieldCollectionAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/FieldCollectionAdapter.php similarity index 96% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/FieldCollectionAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/FieldCollectionAdapter.php index 5228e483..2d50107d 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/FieldCollectionAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/FieldCollectionAdapter.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Exception; use InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\FieldCollection\DefinitionResolverInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Fieldcollections; use Pimcore\Model\DataObject\Fieldcollection; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapter.php similarity index 94% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapter.php index 05dc1166..68beec14 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/GeographicPointAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/GeographicPointAdapter.php similarity index 93% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/GeographicPointAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/GeographicPointAdapter.php index fab8e261..0511ef8d 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/GeographicPointAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/GeographicPointAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/HasLatitudeAnfLongitudeTrait.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/HasLatitudeAnfLongitudeTrait.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/HasLatitudeAnfLongitudeTrait.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/HasLatitudeAnfLongitudeTrait.php index d4602999..8400ff34 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/HasLatitudeAnfLongitudeTrait.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/HasLatitudeAnfLongitudeTrait.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ImageAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ImageAdapter.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ImageAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ImageAdapter.php index 557eab0a..a024acdd 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ImageAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ImageAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ImageGalleryAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ImageGalleryAdapter.php similarity index 94% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ImageGalleryAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ImageGalleryAdapter.php index b2c87897..13a61d59 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ImageGalleryAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ImageGalleryAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/InputQuantityValueAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/InputQuantityValueAdapter.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/InputQuantityValueAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/InputQuantityValueAdapter.php index 9ddfd686..a57b9b0d 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/InputQuantityValueAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/InputQuantityValueAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/LinkAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/LinkAdapter.php similarity index 94% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/LinkAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/LinkAdapter.php index ae2be11c..edd86f89 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/LinkAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/LinkAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/LocalizedFieldsAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/LocalizedFieldsAdapter.php similarity index 98% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/LocalizedFieldsAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/LocalizedFieldsAdapter.php index c7af14c2..2bb06a41 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/LocalizedFieldsAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/LocalizedFieldsAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Exception; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\LanguageServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/NumericAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/NumericAdapter.php similarity index 84% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/NumericAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/NumericAdapter.php index 32a4c54a..1537df1f 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/NumericAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/NumericAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/NumericRangeAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/NumericRangeAdapter.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/NumericRangeAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/NumericRangeAdapter.php index eec7aad9..6ddc6eee 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/NumericRangeAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/NumericRangeAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ObjectBrickAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ObjectBrickAdapter.php similarity index 98% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ObjectBrickAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ObjectBrickAdapter.php index d08ec68b..55e3d665 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/ObjectBrickAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/ObjectBrickAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use InvalidArgumentException; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\Objectbrick\DefinitionResolverInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/QuantityValueAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/QuantityValueAdapter.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/QuantityValueAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/QuantityValueAdapter.php index baae7333..234b1149 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/QuantityValueAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/QuantityValueAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapter.php similarity index 88% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapter.php index e14185d4..e35ad000 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/RelationAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/RelationAdapter.php similarity index 93% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/RelationAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/RelationAdapter.php index 9dcea067..0ce16767 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/RelationAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/RelationAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Normalizer\NormalizerInterface; /** diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/RgbaColorAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/RgbaColorAdapter.php similarity index 89% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/RgbaColorAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/RgbaColorAdapter.php index 1af2ca7a..cc87fc92 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/RgbaColorAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/RgbaColorAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/StructuredTableAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/StructuredTableAdapter.php similarity index 95% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/StructuredTableAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/StructuredTableAdapter.php index a270bc9f..1f866933 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/StructuredTableAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/StructuredTableAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; use Pimcore\Model\DataObject\ClassDefinition\Data\StructuredTable; use Pimcore\Normalizer\NormalizerInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TableAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TableAdapter.php similarity index 98% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TableAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TableAdapter.php index 00a468d0..a5b781c5 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TableAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TableAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php similarity index 96% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php index 7d426c41..ce2382ea 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TimeAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TimeAdapter.php similarity index 84% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TimeAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TimeAdapter.php index 9672935f..195a6824 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/TimeAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TimeAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/UrlSlugAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/UrlSlugAdapter.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/UrlSlugAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/UrlSlugAdapter.php index fffd5782..00c1473b 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/UrlSlugAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/UrlSlugAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/VideoAdapter.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/VideoAdapter.php similarity index 95% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/VideoAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/VideoAdapter.php index 51d16165..af3577ec 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/VideoAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/VideoAdapter.php @@ -14,9 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Normalizer\NormalizerInterface; /** diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionService.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionService.php similarity index 98% rename from src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionService.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionService.php index ed87231f..2a65af6b 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionService.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionService.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\AdapterInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/IndexIconUpdateService.php b/src/SearchIndexAdapter/DefaultSearch/DataObject/IndexIconUpdateService.php similarity index 92% rename from src/SearchIndexAdapter/OpenSearch/DataObject/IndexIconUpdateService.php rename to src/SearchIndexAdapter/DefaultSearch/DataObject/IndexIconUpdateService.php index 157cd4bf..f1c97fe2 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/IndexIconUpdateService.php +++ b/src/SearchIndexAdapter/DefaultSearch/DataObject/IndexIconUpdateService.php @@ -14,18 +14,18 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject; -use OpenSearch\Client; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\IndexIconUpdateServiceInterface; +use Pimcore\SearchClient\SearchClientInterface; /** * @internal */ final readonly class IndexIconUpdateService implements IndexIconUpdateServiceInterface { - public function __construct(private Client $openSearchClient) + public function __construct(private SearchClientInterface $client) { } @@ -47,7 +47,7 @@ public function updateIcon(string $indexName, ?string $icon): void 'query' => $query, ], ]; - $this->openSearchClient->updateByQuery($params); + $this->client->updateByQuery($params); } private function getQueryForNullIcon(): array diff --git a/src/SearchIndexAdapter/OpenSearch/OpenSearchService.php b/src/SearchIndexAdapter/DefaultSearch/DefaultSearchService.php similarity index 82% rename from src/SearchIndexAdapter/OpenSearch/OpenSearchService.php rename to src/SearchIndexAdapter/DefaultSearch/DefaultSearchService.php index 42009f59..b276d808 100644 --- a/src/SearchIndexAdapter/OpenSearch/OpenSearchService.php +++ b/src/SearchIndexAdapter/DefaultSearch/DefaultSearchService.php @@ -14,28 +14,28 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; use Exception; use JsonException; -use OpenSearch\Client; -use Pimcore\Bundle\GenericDataIndexBundle\Exception\OpenSearch\SearchFailedException; +use Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch\SearchFailedException; use Pimcore\Bundle\GenericDataIndexBundle\Exception\SwitchIndexAliasException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Debug\SearchInformation; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Debug\SearchInformation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\SearchResult; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\SearchExecutionServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexAliasServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\SearchExecutionServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\SearchIndexServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Traits\LoggerAwareTrait; +use Pimcore\SearchClient\SearchClientInterface; use Psr\Log\LogLevel; /** * @internal */ -final class OpenSearchService implements SearchIndexServiceInterface +final class DefaultSearchService implements SearchIndexServiceInterface { private const INDEX_VERSION_ODD = 'odd'; @@ -45,9 +45,9 @@ final class OpenSearchService implements SearchIndexServiceInterface public function __construct( private readonly SearchIndexConfigServiceInterface $searchIndexConfigService, - private readonly Client $openSearchClient, private readonly SearchExecutionServiceInterface $searchExecutionService, private readonly IndexAliasServiceInterface $indexAliasService, + private readonly SearchClientInterface $client ) { } @@ -55,9 +55,7 @@ public function refreshIndex(string $indexName): array { $this->logger->info("Refreshing index $indexName"); - return $this->openSearchClient - ->indices() - ->refresh(['index' => $indexName]); + return $this->client->refreshIndex(['index' => $indexName]); } public function deleteIndex($indexName, bool $silent = false): void @@ -68,7 +66,7 @@ public function deleteIndex($indexName, bool $silent = false): void try { $this->logger->log($silent ? LogLevel::DEBUG : LogLevel::INFO, "Deleting index $indexName"); - $response = $this->openSearchClient->indices()->delete(['index' => $indexName]); + $response = $this->client->deleteIndex(['index' => $indexName]); $this->logger->debug(json_encode($response, JSON_THROW_ON_ERROR)); } catch (JsonException $e) { $this->logger->debug('Error while parsing json response: ' . $indexName . ' ' . $e); @@ -81,10 +79,7 @@ public function getCurrentIndexVersion(string $indexName): string return ''; } - $result = $this->openSearchClient->indices()->getAlias([ - 'name' => $indexName, - ]); - + $result = $this->client->getIndexAlias(['name' => $indexName]); if (empty($result)) { return ''; } @@ -121,9 +116,7 @@ public function reindex(string $indexName, array $mapping): void ]; try { - $this->openSearchClient->reindex([ - 'body' => $body, - ]); + $this->client->reIndex(['body' => $body]); } catch (Exception $e) { $this->logger->error('Reindexing failed due to following error: ' . $e); } @@ -131,7 +124,7 @@ public function reindex(string $indexName, array $mapping): void $this->switchIndexAliasAndCleanup($indexName, $oldIndexName, $newIndexName); } - public function createIndex(string $indexName, array $mappings = null): OpenSearchService + public function createIndex(string $indexName, array $mappings = null): DefaultSearchService { $this->deleteIndex($indexName, true); @@ -147,7 +140,7 @@ public function createIndex(string $indexName, array $mappings = null): OpenSear $body['mappings']['properties'] = $mappings; } - $response = $this->openSearchClient->indices()->create( + $response = $this->client->createIndex( [ 'index' => $indexName, 'body' => $body, @@ -174,7 +167,7 @@ public function existsAlias(string $aliasName, string $indexName = null): bool public function existsIndex(string $indexName): bool { - return $this->openSearchClient->indices()->exists([ + return $this->client->existsIndex([ 'index' => $indexName, 'client' => [ 'ignore' => [404], @@ -200,22 +193,22 @@ public function getDocument(string $index, int $id, bool $ignore404 = false): ar ]; } - return $this->openSearchClient->get($params); + return $this->client->get($params); } public function putMapping(array $params): array { - return $this->openSearchClient->indices()->putMapping($params); + return $this->client->putIndexMapping($params); } public function getMapping(string $indexName): array { - return $this->openSearchClient->indices()->getMapping(['index' => $indexName]); + return $this->client->getIndexMapping(['index' => $indexName]); } public function countByAttributeValue(string $indexName, string $attribute, string $value): int { - $countResult = $this->openSearchClient->search([ + $countResult = $this->client->search([ 'index' => $indexName, 'track_total_hits' => true, 'rest_total_hits_as_int' => true, @@ -268,9 +261,7 @@ public function getExecutedSearches(): array public function getStats(string $indexName): array { - return $this->openSearchClient - ->indices() - ->stats(['index' => $indexName]); + return $this->client->getIndexStats(['index' => $indexName]); } public function getCount(AdapterSearchInterface $search, string $indexName): int @@ -278,15 +269,20 @@ public function getCount(AdapterSearchInterface $search, string $indexName): int $body = $search->toArray(); // Remove not allowed keys - $body = array_diff_key($body, array_flip([ - '_source', - 'sort', - 'from', - 'size', - 'aggs', - ])); - - $result = $this->openSearchClient->count([ + $body = array_diff_key( + $body, + array_flip( + [ + '_source', + 'sort', + 'from', + 'size', + 'aggs', + ] + ) + ); + + $result = $this->client->count([ 'index' => $indexName, 'body' => $body, ]); @@ -315,7 +311,8 @@ private function switchIndexAliasAndCleanup(string $aliasName, string $oldIndexN ], ], ]; - $result = $this->openSearchClient->indices()->updateAliases($params); + + $result = $this->client->updateIndexAliases($params); if (!$result['acknowledged']) { throw new SwitchIndexAliasException('Switching Alias failed for ' . $newIndexName); } diff --git a/src/SearchIndexAdapter/OpenSearch/IndexAliasService.php b/src/SearchIndexAdapter/DefaultSearch/IndexAliasService.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/IndexAliasService.php rename to src/SearchIndexAdapter/DefaultSearch/IndexAliasService.php index 497f22f6..0ea7374c 100644 --- a/src/SearchIndexAdapter/OpenSearch/IndexAliasService.php +++ b/src/SearchIndexAdapter/DefaultSearch/IndexAliasService.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; -use OpenSearch\Client; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexAliasServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; +use Pimcore\SearchClient\SearchClientInterface; /** * @internal @@ -26,7 +26,7 @@ final class IndexAliasService implements IndexAliasServiceInterface { public function __construct( - private readonly Client $openSearchClient, + private readonly SearchClientInterface $client, private readonly SearchIndexConfigServiceInterface $searchIndexConfigService, ) { } @@ -44,12 +44,12 @@ public function addAlias(string $aliasName, string $indexName): array ], ]; - return $this->openSearchClient->indices()->updateAliases($params); + return $this->client->updateIndexAliases($params); } public function existsAlias(string $aliasName, string $indexName = null): bool { - return $this->openSearchClient->indices()->existsAlias([ + return $this->client->existsIndexAlias([ 'name' => $aliasName, 'index' => $indexName, 'client' => [ @@ -60,14 +60,15 @@ public function existsAlias(string $aliasName, string $indexName = null): bool public function getAllAliases(): array { - return $this->openSearchClient->cat()->aliases([ + return $this->client->getAllIndexAliases([ 'name' => $this->searchIndexConfigService->getIndexPrefix() . '*', + 'format' => 'json', ]); } public function deleteAlias(string $indexName, string $aliasName): array { - return $this->openSearchClient->indices()->deleteAlias([ + return $this->client->deleteIndexAlias([ 'name' => $aliasName, 'index' => $indexName, ]); @@ -98,7 +99,7 @@ public function updateAliases(string $alias, array $indexNames, array $existingI } if (!empty($actions)) { - return $this->openSearchClient->indices()->updateAliases([ + return $this->client->updateIndexAliases([ 'body' => [ 'actions' => $actions, ], diff --git a/src/SearchIndexAdapter/OpenSearch/IndexMappingService.php b/src/SearchIndexAdapter/DefaultSearch/IndexMappingService.php similarity index 90% rename from src/SearchIndexAdapter/OpenSearch/IndexMappingService.php rename to src/SearchIndexAdapter/DefaultSearch/IndexMappingService.php index 9a6115b3..d6a538fb 100644 --- a/src/SearchIndexAdapter/OpenSearch/IndexMappingService.php +++ b/src/SearchIndexAdapter/DefaultSearch/IndexMappingService.php @@ -14,13 +14,15 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ClientType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidMappingException; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Mapping; +use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data; /** @@ -30,6 +32,7 @@ { public function __construct( private FieldDefinitionServiceInterface $fieldDefinitionService, + private SearchIndexConfigServiceInterface $searchIndexConfigService ) { } @@ -134,7 +137,7 @@ private function getAdvancedImagePointData(array $attributes): array 'properties' => [ 'name' => $this->getMappingForTextKeyword($attributes), 'data' => [ - 'type' => AttributeType::FLAT_OBJECT->value, + 'type' => $this->getFlatAttributeType()->value, ], 'top' => [ 'type' => AttributeType::FLOAT->value, @@ -182,4 +185,11 @@ private function transformLocalizedfields(array $data): array return $data; } + + private function getFlatAttributeType(): AttributeType + { + return $this->searchIndexConfigService->getClientType() === ClientType::OPEN_SEARCH->value ? + AttributeType::FLAT_OBJECT : + AttributeType::FLATTENED; + } } diff --git a/src/SearchIndexAdapter/OpenSearch/IndexStatsService.php b/src/SearchIndexAdapter/DefaultSearch/IndexStatsService.php similarity index 90% rename from src/SearchIndexAdapter/OpenSearch/IndexStatsService.php rename to src/SearchIndexAdapter/DefaultSearch/IndexStatsService.php index f8e3925c..fe055f8b 100644 --- a/src/SearchIndexAdapter/OpenSearch/IndexStatsService.php +++ b/src/SearchIndexAdapter/DefaultSearch/IndexStatsService.php @@ -14,10 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; use Exception; -use OpenSearch\Client; use Pimcore\Bundle\GenericDataIndexBundle\Model\Stats\IndexStats; use Pimcore\Bundle\GenericDataIndexBundle\Model\Stats\IndexStatsIndex; use Pimcore\Bundle\GenericDataIndexBundle\Repository\IndexQueueRepository; @@ -25,6 +24,7 @@ use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\SearchIndexServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Traits\LoggerAwareTrait; +use Pimcore\SearchClient\SearchClientInterface; /** * @internal @@ -34,21 +34,21 @@ final class IndexStatsService implements IndexStatsServiceInterface use LoggerAwareTrait; public function __construct( + private readonly SearchClientInterface $client, private readonly SearchIndexConfigServiceInterface $searchIndexConfigService, private readonly IndexQueueRepository $indexQueueRepository, - private readonly SearchIndexServiceInterface $openSearchService, - private readonly Client $openSearchClient, + private readonly SearchIndexServiceInterface $defaultSearchService ) { } public function getStats(): IndexStats { - $allStats = $this->openSearchService->getStats( + $allStats = $this->defaultSearchService->getStats( $this->searchIndexConfigService->getIndexPrefix() . '*' ); - $aggregationResult = $this->openSearchClient->search([ + $aggregationResult = $this->client->search([ 'index' => $this->searchIndexConfigService->getIndexPrefix() . '*', 'body' => [ 'size' => 0, diff --git a/src/SearchIndexAdapter/OpenSearch/MappingAnalyzerService.php b/src/SearchIndexAdapter/DefaultSearch/MappingAnalyzerService.php similarity index 98% rename from src/SearchIndexAdapter/OpenSearch/MappingAnalyzerService.php rename to src/SearchIndexAdapter/DefaultSearch/MappingAnalyzerService.php index 8d12b0ea..05e6743e 100644 --- a/src/SearchIndexAdapter/OpenSearch/MappingAnalyzerService.php +++ b/src/SearchIndexAdapter/DefaultSearch/MappingAnalyzerService.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/MappingAnalyzerServiceInterface.php b/src/SearchIndexAdapter/DefaultSearch/MappingAnalyzerServiceInterface.php similarity index 97% rename from src/SearchIndexAdapter/OpenSearch/MappingAnalyzerServiceInterface.php rename to src/SearchIndexAdapter/DefaultSearch/MappingAnalyzerServiceInterface.php index da09e9cf..b7403fd0 100644 --- a/src/SearchIndexAdapter/OpenSearch/MappingAnalyzerServiceInterface.php +++ b/src/SearchIndexAdapter/DefaultSearch/MappingAnalyzerServiceInterface.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; /** * @internal diff --git a/src/SearchIndexAdapter/OpenSearch/PathService.php b/src/SearchIndexAdapter/DefaultSearch/PathService.php similarity index 96% rename from src/SearchIndexAdapter/OpenSearch/PathService.php rename to src/SearchIndexAdapter/DefaultSearch/PathService.php index 4a7b562d..936af3ee 100644 --- a/src/SearchIndexAdapter/OpenSearch/PathService.php +++ b/src/SearchIndexAdapter/DefaultSearch/PathService.php @@ -14,10 +14,9 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch; use Exception; -use OpenSearch\Client; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\PathServiceInterface; @@ -25,6 +24,7 @@ use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Traits\LoggerAwareTrait; use Pimcore\Model\Element\ElementInterface; +use Pimcore\SearchClient\SearchClientInterface; /** * @internal @@ -34,7 +34,7 @@ final class PathService implements PathServiceInterface use LoggerAwareTrait; public function __construct( - private readonly Client $openSearchClient, + private readonly SearchClientInterface $client, private readonly AdapterServiceInterface $typeAdapterService, private readonly SearchIndexConfigServiceInterface $searchIndexConfigService, ) { @@ -92,7 +92,7 @@ public function getCurrentIndexFullPath(ElementInterface $element): ?string ->getTypeAdapter($element) ->getAliasIndexNameByElement($element); - $result = $this->openSearchClient->search( + $result = $this->client->search( [ 'index' => $indexName, 'body' => [ @@ -141,7 +141,7 @@ private function updatePath(string $indexName, string $currentPath, string $newP ], ]; - $this->openSearchClient->updateByQuery($query); + $this->client->updateByQuery($query); } private function getScriptSource(): string @@ -171,7 +171,7 @@ private function getScriptSource(): string private function countDocumentsByPath(string $indexName, string $path): int { - $countResult = $this->openSearchClient->search([ + $countResult = $this->client->search([ 'index' => $indexName, 'track_total_hits' => true, 'rest_total_hits_as_int' => true, diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformer.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformer.php index 20644f4c..47dfbcba 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformer.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\MappingProperty; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Used by asset metadata fields to add the default language to the field name. diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformer.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformer.php index 2e2eb821..7157791d 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformer.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Prepends the field category (system_fields, standard_fields, custom_fields) diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/IdTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/IdTransformer.php similarity index 83% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/IdTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/IdTransformer.php index 1bfb3408..ce532ced 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/IdTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/IdTransformer.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Used for image and video data types to transform the field name to the id field. diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformer.php similarity index 85% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformer.php index b0977c50..e7d05e35 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformer.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexType; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Used for the image gallery data type. diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/KeywordTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/KeywordTransformer.php similarity index 83% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/KeywordTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/KeywordTransformer.php index 67076ded..ce9e0ac7 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/KeywordTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/KeywordTransformer.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Used to filter based on a keyword subfield if available. diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/RelationsTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/RelationsTransformer.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/RelationsTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/RelationsTransformer.php index 29684000..192d9eda 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/RelationsTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/RelationsTransformer.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexType; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Used by relation data types to transform the field name to the correct element type relation field. diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SortTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SortTransformer.php similarity index 83% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SortTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SortTransformer.php index 036684b5..a15df321 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SortTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SortTransformer.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Used to filter based on a sort subfield if available. diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SynonymTransformer.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SynonymTransformer.php similarity index 89% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SynonymTransformer.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SynonymTransformer.php index baa4530b..189c917e 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SynonymTransformer.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SynonymTransformer.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexType; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; /** * Used to filter based on a keyword subfield if available. diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformerInterface.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformerInterface.php similarity index 97% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformerInterface.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformerInterface.php index 9d6d107f..da175e12 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformerInterface.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformerInterface.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/FieldExistsValidator.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/FieldExistsValidator.php similarity index 82% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/FieldExistsValidator.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/FieldExistsValidator.php index c6b21994..12d662dd 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/FieldExistsValidator.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/FieldExistsValidator.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameValidator; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameValidator; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameValidatorInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameValidatorInterface; use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem; /** diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/LocalizedFieldValidator.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/LocalizedFieldValidator.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/LocalizedFieldValidator.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/LocalizedFieldValidator.php index 5a4a6726..5cb83972 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/LocalizedFieldValidator.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/LocalizedFieldValidator.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameValidator; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameValidator; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameValidatorInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameValidatorInterface; use Pimcore\Tool; use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem; diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/RelationValidator.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/RelationValidator.php similarity index 87% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/RelationValidator.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/RelationValidator.php index c5ae58a5..2e6a5b26 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidator/RelationValidator.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidator/RelationValidator.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameValidator; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameValidator; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameValidatorInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameValidatorInterface; use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem; /** diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidatorInterface.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidatorInterface.php similarity index 90% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidatorInterface.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidatorInterface.php index cde5c0d7..b94b7fc6 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameValidatorInterface.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameValidatorInterface.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; @@ -24,7 +24,7 @@ interface FieldNameValidatorInterface { /** - * Returns a error message if the field name is invalid + * Returns an error message if the field name is invalid */ public function validateFieldName( string $originalFieldName, diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/PqlAdapter.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/PqlAdapter.php similarity index 99% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/PqlAdapter.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/PqlAdapter.php index f00f40c7..b0587b63 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/PqlAdapter.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/PqlAdapter.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage; use Pimcore\Bundle\GenericDataIndexBundle\Enum\DependencyInjection\ServiceTag; use Pimcore\Bundle\GenericDataIndexBundle\Enum\QueryLanguage\QueryTokenType; diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/SubQueriesProcessor.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/SubQueriesProcessor.php similarity index 89% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/SubQueriesProcessor.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/SubQueriesProcessor.php index 4ea62b81..0be54493 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/SubQueriesProcessor.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/SubQueriesProcessor.php @@ -14,15 +14,15 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\ConditionType; use Pimcore\Bundle\GenericDataIndexBundle\Exception\QueryLanguage\ParsingException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\QueryLanguage\SubQueryResultList; use Pimcore\Bundle\GenericDataIndexBundle\QueryLanguage\ProcessorInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\FetchIdsBySearchServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\FetchIdsBySearchServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\SearchIndexServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexEntityServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/SubQueriesProcessorInterface.php b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/SubQueriesProcessorInterface.php similarity index 97% rename from src/SearchIndexAdapter/OpenSearch/QueryLanguage/SubQueriesProcessorInterface.php rename to src/SearchIndexAdapter/DefaultSearch/QueryLanguage/SubQueriesProcessorInterface.php index 0f0973a6..ff0eb5c2 100644 --- a/src/SearchIndexAdapter/OpenSearch/QueryLanguage/SubQueriesProcessorInterface.php +++ b/src/SearchIndexAdapter/DefaultSearch/QueryLanguage/SubQueriesProcessorInterface.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage; use Pimcore\Bundle\GenericDataIndexBundle\Exception\QueryLanguage\ParsingException; use Pimcore\Bundle\GenericDataIndexBundle\Model\QueryLanguage\ParseResultSubQuery; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/FetchIdsBySearchService.php b/src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsBySearchService.php similarity index 82% rename from src/SearchIndexAdapter/OpenSearch/Search/FetchIdsBySearchService.php rename to src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsBySearchService.php index 015445ce..3138d920 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/FetchIdsBySearchService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsBySearchService.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSort; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSortList; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\DefaultSearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSortList; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\SearchIndexServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; @@ -35,7 +35,7 @@ public function __construct( ) { } - public function fetchAllIds(OpenSearchSearchInterface $search, string $indexName, bool $sortById = true): array + public function fetchAllIds(DefaultSearchInterface $search, string $indexName, bool $sortById = true): array { $search = clone $search; if ($sortById) { @@ -49,7 +49,7 @@ public function fetchAllIds(OpenSearchSearchInterface $search, string $indexName return $this->doFetchIds($search, $indexName); } - private function doFetchIds(OpenSearchSearchInterface $search, string $indexName, ?array $searchAfter = null): array + private function doFetchIds(DefaultSearchInterface $search, string $indexName, ?array $searchAfter = null): array { $search->setFrom(0); $search->setSize($this->getPageSize()); diff --git a/src/SearchIndexAdapter/OpenSearch/Search/FetchIdsBySearchServiceInterface.php b/src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsBySearchServiceInterface.php similarity index 71% rename from src/SearchIndexAdapter/OpenSearch/Search/FetchIdsBySearchServiceInterface.php rename to src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsBySearchServiceInterface.php index db10dc81..ad47b26a 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/FetchIdsBySearchServiceInterface.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsBySearchServiceInterface.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\DefaultSearchInterface; interface FetchIdsBySearchServiceInterface { - public function fetchAllIds(OpenSearchSearchInterface $search, string $indexName, bool $sortById = true): array; + public function fetchAllIds(DefaultSearchInterface $search, string $indexName, bool $sortById = true): array; } diff --git a/src/SearchIndexAdapter/OpenSearch/Search/FetchIdsService.php b/src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsService.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/Search/FetchIdsService.php rename to src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsService.php index 33f72fb3..8d1582fc 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/FetchIdsService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/FetchIdsService.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSort; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSortList; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\DefaultSearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSortList; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\FetchIdsServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\SearchIndexServiceInterface; @@ -60,9 +60,9 @@ public function fetchAllIds(AdapterSearchInterface $search, string $indexName): return $this->fetchIdsBySearchService->fetchAllIds($search, $indexName, false); } - private function validateSearch(AdapterSearchInterface $search): OpenSearchSearchInterface + private function validateSearch(AdapterSearchInterface $search): DefaultSearchInterface { - if (!$search instanceof OpenSearchSearchInterface) { + if (!$search instanceof DefaultSearchInterface) { throw new InvalidArgumentException('Search must be an instance of OpenSearchSearchInterface'); } diff --git a/src/SearchIndexAdapter/OpenSearch/Search/LocateInTreeService.php b/src/SearchIndexAdapter/DefaultSearch/Search/LocateInTreeService.php similarity index 84% rename from src/SearchIndexAdapter/OpenSearch/Search/LocateInTreeService.php rename to src/SearchIndexAdapter/DefaultSearch/Search/LocateInTreeService.php index b1752e9b..f2e604cb 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/LocateInTreeService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/LocateInTreeService.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\SearchResult; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Search\LocateInTreeServiceInterface; @@ -54,13 +54,13 @@ private function getElementPosition(SearchInterface $search, int $elementId): ?i { $indexName = $this->indexNameResolver->resolveIndexName($search); - $openSearchSearch = $this->createOpenSearchSearch($search); + $defaultSearch = $this->createDefaultSearch($search); - if ($openSearchSearch->getSortList()->isEmpty()) { + if ($defaultSearch->getSortList()->isEmpty()) { throw new InvalidArgumentException('Search must have a sort defined to be able to locate in tree'); } - $count = $this->searchIndexService->getCount($openSearchSearch, $indexName); + $count = $this->searchIndexService->getCount($defaultSearch, $indexName); if ($count < 1) { return null; @@ -71,10 +71,10 @@ private function getElementPosition(SearchInterface $search, int $elementId): ?i $lastSearchResult = null; for ($page = 1; $page <= $totalPages; $page++) { - $openSearchSearch = $this->createOpenSearchSearch($search, $pageSize, $lastSearchResult); + $defaultSearch = $this->createDefaultSearch($search, $pageSize, $lastSearchResult); $lastSearchResult = $this->searchIndexService->search( - $openSearchSearch, + $defaultSearch, $indexName, ); @@ -88,28 +88,28 @@ private function getElementPosition(SearchInterface $search, int $elementId): ?i return null; } - private function createOpenSearchSearch( + private function createDefaultSearch( SearchInterface $search, int $pageSize = null, SearchResult $searchAfterSearchResult = null ): Search { $pageSize = $pageSize ?? $search->getPageSize(); - /** @var Search $openSearchSearch */ - $openSearchSearch = $this->searchIndexService->createPaginatedSearch(1, $pageSize); - $this->searchModifierService->applyModifiersFromSearch($search, $openSearchSearch); + /** @var Search $defaultSearch */ + $defaultSearch = $this->searchIndexService->createPaginatedSearch(1, $pageSize); + $this->searchModifierService->applyModifiersFromSearch($search, $defaultSearch); if ($searchAfterSearchResult !== null) { $searchAfter = $searchAfterSearchResult->getLastHit()?->getSort(); if (empty($searchAfter)) { - return $openSearchSearch; + return $defaultSearch; } - $openSearchSearch->setSearchAfter( + $defaultSearch->setSearchAfter( $searchAfter ); } - return $openSearchSearch; + return $defaultSearch; } private function getElementPositionInSearchResult(SearchResult $searchResult, int $elementId): ?int diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Aggregation/AssetAggregations.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Aggregation/AssetAggregations.php similarity index 90% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Aggregation/AssetAggregations.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Aggregation/AssetAggregations.php index 95dd3347..8c2d71a3 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Aggregation/AssetAggregations.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Aggregation/AssetAggregations.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Aggregation; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Aggregation; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidModifierException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\AssetSearch; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Aggregation\Asset\AssetMetaDataAggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Aggregation\Asset\FileSizeSumAggregation; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Aggregation/TreeAggregations.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Aggregation/TreeAggregations.php similarity index 80% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Aggregation/TreeAggregations.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Aggregation/TreeAggregations.php index b886be8e..6261f2f8 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Aggregation/TreeAggregations.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Aggregation/TreeAggregations.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Aggregation; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Aggregation; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermsFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermsFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Aggregation\Tree\ChildrenCountAggregation; /** diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/AssetFilters.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/AssetFilters.php similarity index 89% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/AssetFilters.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/AssetFilters.php index 9cbde507..8377d87d 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/AssetFilters.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/AssetFilters.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidModifierException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Asset\FieldDefinitionServiceInterface; use Pimcore\Twig\Extension\Templating\Placeholder\Exception; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/BasicFilters.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/BasicFilters.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/BasicFilters.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/BasicFilters.php index 6a3a9b05..7b3039a5 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/BasicFilters.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/BasicFilters.php @@ -14,14 +14,14 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermsFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermsFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Basic\ExcludeFoldersFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Basic\IdFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Basic\IdsFilter; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/DependencyFilters.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/DependencyFilters.php similarity index 86% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/DependencyFilters.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/DependencyFilters.php index b05f0fa8..6f05a461 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/DependencyFilters.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/DependencyFilters.php @@ -14,16 +14,16 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\ConditionType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ElementType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermsFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermsFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Dependency\RequiredByFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Dependency\RequiresFilter; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\Element\ElementSearchServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/FieldTypeFilters.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/FieldTypeFilters.php similarity index 91% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/FieldTypeFilters.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/FieldTypeFilters.php index b7c452d9..d0a811d8 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/FieldTypeFilters.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/FieldTypeFilters.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\FieldType\DateFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\FieldType\MultiSelectFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\FieldType\NumberRangeFilter; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/TreeFilters.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/TreeFilters.php similarity index 90% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/TreeFilters.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/TreeFilters.php index ade24b7b..eb3c1ee7 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/TreeFilters.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/TreeFilters.php @@ -14,14 +14,14 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\ConditionType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Tree\ParentIdFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Tree\PathFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Tree\TagFilter; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/Workspace/WorkspaceQueryHandler.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/Workspace/WorkspaceQueryHandler.php similarity index 90% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/Workspace/WorkspaceQueryHandler.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/Workspace/WorkspaceQueryHandler.php index ac0cfb90..36e4c806 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Filter/Workspace/WorkspaceQueryHandler.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Filter/Workspace/WorkspaceQueryHandler.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Filter\Workspace; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Filter\Workspace; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Workspaces\ElementWorkspacesQuery; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Workspaces\WorkspaceQuery; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Workspace\ElementWorkspacesQueryServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/FullTextSearch/FullTextSearchHandlers.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/FullTextSearch/FullTextSearchHandlers.php similarity index 85% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/FullTextSearch/FullTextSearchHandlers.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/FullTextSearch/FullTextSearchHandlers.php index de29adf1..013bb26e 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/FullTextSearch/FullTextSearchHandlers.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/FullTextSearch/FullTextSearchHandlers.php @@ -14,14 +14,14 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\FullTextSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\FullTextSearch; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\WildcardFilterMode; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\WildcardFilterMode; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\SimpleQueryStringFilter; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\WildcardFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\SimpleQueryStringFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\WildcardFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\FullTextSearch\ElementKeySearch; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\FullTextSearch\FullTextSearch; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\FullTextSearch\WildcardSearch; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/QueryLanguage/QueryLanguageHandlers.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/QueryLanguage/QueryLanguageHandlers.php similarity index 82% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/QueryLanguage/QueryLanguageHandlers.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/QueryLanguage/QueryLanguageHandlers.php index 18459a66..73c64638 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/QueryLanguage/QueryLanguageHandlers.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/QueryLanguage/QueryLanguageHandlers.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\QueryLanguage; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\QueryLanguage; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\ConditionType; use Pimcore\Bundle\GenericDataIndexBundle\Exception\QueryLanguage\ParsingException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\QueryLanguage\PqlFilter; use Pimcore\Bundle\GenericDataIndexBundle\QueryLanguage\ProcessorInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\IndexNameResolverInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/SearchModifierService.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/SearchModifierService.php similarity index 92% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/SearchModifierService.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/SearchModifierService.php index cad95f2b..bc69ad5b 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/SearchModifierService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/SearchModifierService.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContext; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContext; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\SearchModifierInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Sort/OrderByFieldsHandlers.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Sort/OrderByFieldsHandlers.php similarity index 84% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Sort/OrderByFieldsHandlers.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Sort/OrderByFieldsHandlers.php index 51e35fac..d1280af9 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Sort/OrderByFieldsHandlers.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Sort/OrderByFieldsHandlers.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Sort; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Sort; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSort; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\OrderByField; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\SearchPqlFieldNameTransformationServiceInterface; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Sort/TreeSortHandlers.php b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Sort/TreeSortHandlers.php similarity index 91% rename from src/SearchIndexAdapter/OpenSearch/Search/Modifier/Sort/TreeSortHandlers.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Sort/TreeSortHandlers.php index 1b685130..5367226b 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Modifier/Sort/TreeSortHandlers.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Modifier/Sort/TreeSortHandlers.php @@ -14,14 +14,14 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Sort; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Sort; -use Pimcore\Bundle\GenericDataIndexBundle\Attribute\OpenSearch\AsSearchModifierHandler; +use Pimcore\Bundle\GenericDataIndexBundle\Attribute\Search\AsSearchModifierHandler; use Pimcore\Bundle\GenericDataIndexBundle\Enum\Search\SortDirection; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContextInterface; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSort; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Sort\FieldSortList; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContextInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSort; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Sort\FieldSortList; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\DataObject\DataObjectSearch; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\OrderByPageNumber; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\Tree\OrderByFullPath; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/Pagination/PaginationInfoService.php b/src/SearchIndexAdapter/DefaultSearch/Search/Pagination/PaginationInfoService.php similarity index 97% rename from src/SearchIndexAdapter/OpenSearch/Search/Pagination/PaginationInfoService.php rename to src/SearchIndexAdapter/DefaultSearch/Search/Pagination/PaginationInfoService.php index 1356d518..1444e856 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/Pagination/PaginationInfoService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/Pagination/PaginationInfoService.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Pagination; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Pagination; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Paging\PaginationInfo; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\SearchResult; diff --git a/src/SearchIndexAdapter/OpenSearch/Search/SearchExecutionService.php b/src/SearchIndexAdapter/DefaultSearch/Search/SearchExecutionService.php similarity index 80% rename from src/SearchIndexAdapter/OpenSearch/Search/SearchExecutionService.php rename to src/SearchIndexAdapter/DefaultSearch/Search/SearchExecutionService.php index dc7e72ee..b8051f31 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/SearchExecutionService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/SearchExecutionService.php @@ -14,16 +14,16 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search; use Exception; -use OpenSearch\Client; -use Pimcore\Bundle\GenericDataIndexBundle\Exception\OpenSearch\ResultWindowTooLargeException; -use Pimcore\Bundle\GenericDataIndexBundle\Exception\OpenSearch\SearchFailedException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Debug\SearchInformation; +use Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch\ResultWindowTooLargeException; +use Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch\SearchFailedException; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Debug\SearchInformation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\SearchResult; use Pimcore\Bundle\GenericDataIndexBundle\Service\Serializer\Denormalizer\SearchIndexAdapter\SearchResultDenormalizer; +use Pimcore\SearchClient\SearchClientInterface; use Symfony\Component\Stopwatch\Stopwatch; /** @@ -38,7 +38,7 @@ final class SearchExecutionService implements SearchExecutionServiceInterface public function __construct( private readonly SearchResultDenormalizer $searchResultDenormalizer, - private readonly Client $openSearchClient, + private readonly SearchClientInterface $client, ) { } @@ -51,8 +51,8 @@ public function executeSearch(AdapterSearchInterface $search, string $indexName) $stopWatch = new Stopwatch(); $stopWatch->start('search'); - $openSearchResult = $this - ->openSearchClient + $defaultSearchResult = $this + ->client ->search([ 'index' => $indexName, 'body' => $search->toArray(), @@ -89,19 +89,19 @@ public function executeSearch(AdapterSearchInterface $search, string $indexName) } if ($search->isReverseItemOrder()) { - $openSearchResult['hits']['hits'] = array_reverse($openSearchResult['hits']['hits']); + $defaultSearchResult['hits']['hits'] = array_reverse($defaultSearchResult['hits']['hits']); } $this->executedSearches[] = new SearchInformation( $search, true, - $openSearchResult, + $defaultSearchResult, $executionTime, debug_backtrace(), ); return $this->searchResultDenormalizer->denormalize( - $openSearchResult, + $defaultSearchResult, SearchResult::class, null, ['search' => $search] @@ -116,10 +116,7 @@ public function getExecutedSearches(): array private function isWindowTooLarge(Exception $e): bool { try { - $reason = json_decode($e->getMessage(), false, 512, JSON_THROW_ON_ERROR) - ->error->caused_by->reason; - - if (str_contains($reason, 'window is too large')) { + if (str_contains($e->getMessage(), 'window is too large')) { return true; } diff --git a/src/SearchIndexAdapter/OpenSearch/Search/SearchExecutionServiceInterface.php b/src/SearchIndexAdapter/DefaultSearch/Search/SearchExecutionServiceInterface.php similarity index 83% rename from src/SearchIndexAdapter/OpenSearch/Search/SearchExecutionServiceInterface.php rename to src/SearchIndexAdapter/DefaultSearch/Search/SearchExecutionServiceInterface.php index 6fda5092..ea364279 100644 --- a/src/SearchIndexAdapter/OpenSearch/Search/SearchExecutionServiceInterface.php +++ b/src/SearchIndexAdapter/DefaultSearch/Search/SearchExecutionServiceInterface.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search; -use Pimcore\Bundle\GenericDataIndexBundle\Exception\OpenSearch\SearchFailedException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Debug\SearchInformation; +use Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch\SearchFailedException; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Debug\SearchInformation; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\AdapterSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndexAdapter\SearchResult; diff --git a/src/SearchIndexAdapter/OpenSearch/Workspace/ElementWorkspacesQueryService.php b/src/SearchIndexAdapter/DefaultSearch/Workspace/ElementWorkspacesQueryService.php similarity index 91% rename from src/SearchIndexAdapter/OpenSearch/Workspace/ElementWorkspacesQueryService.php rename to src/SearchIndexAdapter/DefaultSearch/Workspace/ElementWorkspacesQueryService.php index ec761ee3..2b41b787 100644 --- a/src/SearchIndexAdapter/OpenSearch/Workspace/ElementWorkspacesQueryService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Workspace/ElementWorkspacesQueryService.php @@ -14,15 +14,15 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Workspace; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Workspace; use Pimcore\Bundle\GenericDataIndexBundle\Enum\Permission\UserPermissionTypes; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\ConditionType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ElementType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermsFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermsFilter; use Pimcore\Bundle\GenericDataIndexBundle\Permission\Workspace\AssetWorkspace; use Pimcore\Bundle\GenericDataIndexBundle\Permission\Workspace\DataObjectWorkspace; use Pimcore\Bundle\GenericDataIndexBundle\Permission\Workspace\DocumentWorkspace; diff --git a/src/SearchIndexAdapter/OpenSearch/Workspace/QueryService.php b/src/SearchIndexAdapter/DefaultSearch/Workspace/QueryService.php similarity index 96% rename from src/SearchIndexAdapter/OpenSearch/Workspace/QueryService.php rename to src/SearchIndexAdapter/DefaultSearch/Workspace/QueryService.php index 7322cee4..6e22acac 100644 --- a/src/SearchIndexAdapter/OpenSearch/Workspace/QueryService.php +++ b/src/SearchIndexAdapter/DefaultSearch/Workspace/QueryService.php @@ -14,14 +14,14 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Workspace; +namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Workspace; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\ConditionType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory\SystemField; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexName; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\ConditionType; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Permission\Workspace\AssetWorkspace; use Pimcore\Bundle\GenericDataIndexBundle\Permission\Workspace\DataObjectWorkspace; use Pimcore\Bundle\GenericDataIndexBundle\Permission\Workspace\DocumentWorkspace; @@ -145,7 +145,7 @@ private function createWorkspacesGroupQuery(string $workspaceType, array $group, $declinedPaths = array_unique($declinedPaths); $declinedPaths = $this->evaluateDeclinedPaths($workspaceType, $allowedPaths, $declinedPaths); - if (count($allowedPaths) === 0) { + if (empty($allowedPaths)) { return $this->createNoWorkspaceAllowedQuery(); } diff --git a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php b/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php index cb239513..ec05f409 100644 --- a/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php +++ b/src/SearchIndexAdapter/OpenSearch/Asset/FieldDefinitionAdapter/AbstractAdapter.php @@ -18,7 +18,7 @@ use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\FieldCategory; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Aggregation\Aggregation; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Aggregation\Aggregation; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermsFilter; @@ -31,6 +31,11 @@ use Pimcore\ValueObject\Collection\ArrayOfStrings; use ValueError; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\AbstractAdapter + * instead + */ abstract class AbstractAdapter implements AdapterInterface { public function __construct( diff --git a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php b/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php index 1d41325e..c3476de8 100644 --- a/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php +++ b/src/SearchIndexAdapter/OpenSearch/DataObject/FieldDefinitionAdapter/AbstractAdapter.php @@ -22,6 +22,11 @@ use Pimcore\Model\DataObject\ClassDefinition\Data; use Pimcore\Normalizer\NormalizerInterface; +/** + * @deprecated Will be removed in 2.0, please use + * Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\AbstractAdapter + * instead + */ abstract class AbstractAdapter implements AdapterInterface { private Data $fieldDefinition; diff --git a/src/SearchIndexAdapter/Workspace/ElementWorkspacesQueryServiceInterface.php b/src/SearchIndexAdapter/Workspace/ElementWorkspacesQueryServiceInterface.php index 07bbfdef..be741786 100644 --- a/src/SearchIndexAdapter/Workspace/ElementWorkspacesQueryServiceInterface.php +++ b/src/SearchIndexAdapter/Workspace/ElementWorkspacesQueryServiceInterface.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Workspace; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; use Pimcore\Model\User; /** diff --git a/src/SearchIndexAdapter/Workspace/QueryServiceInterface.php b/src/SearchIndexAdapter/Workspace/QueryServiceInterface.php index f49a5721..007e19ce 100644 --- a/src/SearchIndexAdapter/Workspace/QueryServiceInterface.php +++ b/src/SearchIndexAdapter/Workspace/QueryServiceInterface.php @@ -16,7 +16,7 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\Workspace; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; use Pimcore\Model\User; /** diff --git a/src/Service/SearchIndex/SearchIndexConfigService.php b/src/Service/SearchIndex/SearchIndexConfigService.php index f26e4514..e038187c 100644 --- a/src/Service/SearchIndex/SearchIndexConfigService.php +++ b/src/Service/SearchIndex/SearchIndexConfigService.php @@ -34,6 +34,7 @@ final class SearchIndexConfigService implements SearchIndexConfigServiceInterfac public const SYSTEM_FIELD_DATA_OBJECT = 'data_object'; public function __construct( + private readonly string $clientType, private readonly string $indexPrefix, private readonly array $indexSettings, private readonly array $searchSettings, @@ -41,6 +42,11 @@ public function __construct( ) { } + public function getClientType(): string + { + return $this->clientType; + } + /** * returns index name for given class name */ diff --git a/src/Service/SearchIndex/SearchIndexConfigServiceInterface.php b/src/Service/SearchIndex/SearchIndexConfigServiceInterface.php index 91748e4d..66cc3137 100644 --- a/src/Service/SearchIndex/SearchIndexConfigServiceInterface.php +++ b/src/Service/SearchIndex/SearchIndexConfigServiceInterface.php @@ -21,6 +21,8 @@ */ interface SearchIndexConfigServiceInterface { + public function getClientType(): string; + /** * returns index name for given class name */ diff --git a/src/autoload.php b/src/autoload.php new file mode 100644 index 00000000..622e3cf6 --- /dev/null +++ b/src/autoload.php @@ -0,0 +1,108 @@ + OpenSearchAttributeType::class, + ConditionType::class => OpenSearchConditionType::class, + QueryType::class => OpenSearchQueryType::class, + WildcardFilterMode::class => OpenSearchWildcardFilterMode::class, + SearchFailedException::class => OpenSearchSearchFailedException::class, + Aggregation::class => OpenSearchAggregation::class, + AggregationList::class => OpenSearchAggregationList::class, + SearchInformation::class => OpenSearchSearchInformation::class, + SearchModifierContext::class => OpenSearchModifierContext::class, + SearchModifierContextInterface::class => OpenSearchModifierContextInterface::class, + AsSubQueryInterface::class => OpenSearchAsSubQueryInterface::class, + BoolQuery::class => OpenSearchBoolQuery::class, + DateFilter::class => OpenSearchDateFilter::class, + Query::class => OpenSearchQuery::class, + QueryInterface::class => OpenSearchQueryInterface::class, + QueryList::class => OpenSearchQueryList::class, + SimpleQueryStringFilter::class => OpenSearchSimpleQueryStringFilter::class, + TermFilter::class => OpenSearchTermFilter::class, + TermsFilter::class => OpenSearchTermsFilter::class, + WildcardFilter::class => OpenSearchWildcardFilter::class, + FieldSort::class => OpenSearchFieldSort::class, + FieldSortList::class => OpenSearchFieldSortList::class, + QueryObjectsToArrayTrait::class => OpenSearchQueryObjectsToArrayTrait::class, + SimplifySingleTypesTrait::class => OpenSearchSimplifySingleTypesTrait::class, + Search::class => OpenSearchSearch::class, + DefaultSearchInterface::class => OpenSearchSearchInterface::class, + AssetAbstractAdapter::class => OpenSearchAssetAbstractAdapter::class, + DataObjectAbstractAdapter::class => OpenSearchDataObjectAbstractAdapter::class, +]; + +foreach ($classesToAlias as $originalClass => $aliasClass) { + class_alias($originalClass, $aliasClass); +} diff --git a/tests/Functional/DefaultSearch/DefaultSearchServiceTest.php b/tests/Functional/DefaultSearch/DefaultSearchServiceTest.php new file mode 100644 index 00000000..01e82c54 --- /dev/null +++ b/tests/Functional/DefaultSearch/DefaultSearchServiceTest.php @@ -0,0 +1,272 @@ +tester->flushIndex(); + $this->tester->cleanupIndex(); + $this->tester->flushIndex(); + } + + // tests + + public function testRefreshIndex(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('testindex'); + $searchClient->create(['index' => 'testindex', 'refresh' => false, 'id'=>1, 'body' => ['test' => 'test']]); + $searchIndexService->refreshIndex('testindex'); + $this->assertEquals('test', $searchClient->get(['index' => 'testindex', 'id' => 1])['_source']['test']); + $searchIndexService->deleteIndex('testindex'); + } + + public function testDeleteIndex(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('testindex'); + $this->assertTrue($searchClient->existsIndex(['index' => 'testindex'])); + $searchIndexService->deleteIndex('testindex'); + $this->assertFalse($searchClient->existsIndex(['index' => 'testindex'])); + } + + public function testGetCurrentIndexVersion(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + + $searchIndexService->createIndex('test_index-odd'); + $searchIndexService->addAlias('test_index', 'test_index-odd'); + $this->assertEquals('odd', $searchIndexService->getCurrentIndexVersion('test_index')); + + $searchIndexService->deleteIndex('test_index-odd'); + + $searchIndexService->createIndex('test_index-even'); + $searchIndexService->addAlias('test_index', 'test_index-even'); + $this->assertEquals('even', $searchIndexService->getCurrentIndexVersion('test_index')); + $searchIndexService->deleteIndex('test_index-even'); + } + + public function testReindex(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + + $searchIndexService->createIndex('test_index-odd', ['test'=> ['type'=>'object']]); + $searchIndexService->addAlias('test_index', 'test_index-odd'); + $searchIndexService->reindex('test_index', ['test'=> ['type'=>'keyword']]); + + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + $mapping = $searchClient->getIndexMapping(['index' => 'test_index']); + $this->assertEquals('keyword', $mapping['test_index-even']['mappings']['properties']['test']['type']); + + $searchIndexService->deleteIndex('test_index-even'); + } + + public function testCreateIndex(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('test_index', ['test'=> ['type'=>'object']]); + $mapping = $searchClient->getIndexMapping(['index' => 'test_index']); + $this->assertEquals('object', $mapping['test_index']['mappings']['properties']['test']['type']); + $searchIndexService->deleteIndex('test_index'); + } + + public function testAddAlias(): void + { + + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('test_index'); + $searchIndexService->createIndex('test_index2'); + $searchIndexService->addAlias('test_index_alias', 'test_index'); + $searchIndexService->addAlias('test_index_alias', 'test_index2'); + $this->assertTrue($searchClient->existsIndexAlias(['name' => 'test_index_alias', 'index' => 'test_index'])); + $this->assertTrue($searchClient->existsIndexAlias(['name' => 'test_index_alias', 'index' => 'test_index2'])); + $searchIndexService->deleteIndex('test_index'); + $searchIndexService->deleteIndex('test_index2'); + + } + + public function testExistsAlias(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + + $searchIndexService->createIndex('test_index'); + $searchIndexService->addAlias('test_index_alias', 'test_index'); + + $this->assertTrue($searchIndexService->existsAlias('test_index_alias', 'test_index')); + $this->assertFalse($searchIndexService->existsAlias('test_index_alias', 'test_index2')); + $this->assertFalse($searchIndexService->existsAlias('test_index_alias2', 'test_index')); + + $searchIndexService->deleteIndex('test_index'); + } + + public function testExistsIndex(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + + $searchIndexService->createIndex('test_index'); + $this->assertTrue($searchIndexService->existsIndex('test_index')); + $searchIndexService->deleteIndex('test_index2'); + $this->assertFalse($searchIndexService->existsIndex('test_index2')); + $searchIndexService->deleteIndex('test_index'); + } + + public function testDeleteAlias(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + + $searchIndexService->createIndex('test_index'); + $searchIndexService->addAlias('test_index_alias', 'test_index'); + $this->assertTrue($searchIndexService->existsAlias('test_index_alias', 'test_index')); + $searchIndexService->deleteAlias('test_index', 'test_index_alias'); + $this->assertFalse($searchIndexService->existsAlias('test_index_alias', 'test_index')); + $searchIndexService->deleteIndex('test_index'); + } + + public function testGetDocument(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('test_index'); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>1, 'body' => ['test' => 'test']]); + $document = $searchIndexService->getDocument('test_index', 1); + $this->assertEquals('test', $document['_source']['test']); + + $searchIndexService->getDocument('test_index', 2, true); + $searchIndexService->deleteIndex('test_index'); + $this->tester->checkDeletedIndexEntry(1, 'test_index'); + } + + public function testPutMapping(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('test_index'); + $searchIndexService->putMapping([ + 'index' => 'test_index', + 'body' => ['properties' => ['test' => ['type' => 'keyword']]], + ]); + + $mapping = $searchClient->getIndexMapping(['index' => 'test_index']); + $this->assertEquals('keyword', $mapping['test_index']['mappings']['properties']['test']['type']); + $searchIndexService->deleteIndex('test_index'); + } + + public function testCountByAttributeValue(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('test_index'); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>1, 'body' => ['test' => 'test']]); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>2, 'body' => ['test' => 'test']]); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>3, 'body' => ['test' => 'test']]); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>4, 'body' => ['test' => 'test2']]); + + $this->assertEquals(3, $searchIndexService->countByAttributeValue('test_index', 'test', 'test')); + $this->assertEquals(1, $searchIndexService->countByAttributeValue('test_index', 'test', 'test2')); + $this->assertEquals(0, $searchIndexService->countByAttributeValue('test_index', 'test', 'test3')); + $searchIndexService->deleteIndex('test_index'); + } + + public function testSearch(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + /** @var SearchClientInterface $searchClient */ + $searchClient = $this->tester->grabService('generic-data-index.search-client'); + + $searchIndexService->createIndex('test_index'); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>1, 'body' => ['test' => 'test']]); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>2, 'body' => ['test' => 'test']]); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>3, 'body' => ['test' => 'test']]); + $searchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>4, 'body' => ['test' => 'test2']]); + + /** @var Search $search */ + $search = $searchIndexService->createPaginatedSearch(1, 2); + $search->addQuery(new TermFilter('test', 'test')); + $this->assertEquals(2, $search->getSize()); + $this->assertEquals(0, $search->getFrom()); + + $result = $searchIndexService->search($search, 'test_index'); + $this->assertEquals(3, $result->getTotalHits()); + $this->assertCount(2, $result->getHits()); + + $this->assertCount(1, $searchIndexService->getExecutedSearches()); + $searchInformation = $searchIndexService->getExecutedSearches()[0]; + $this->assertEquals($search, $searchInformation->getSearch()); + $this->assertTrue($searchInformation->isSuccess()); + $this->assertEquals($searchInformation->getResponse()['hits']['total']['value'], $result->getTotalHits()); + $this->assertIsNumeric($searchInformation->getExecutionTime()); + $this->assertNotEmpty($searchInformation->getStackTrace()); + + $searchIndexService->deleteIndex('test_index'); + } + + public function getTestGetStats(): void + { + /** @var SearchIndexServiceInterface $searchIndexService */ + $searchIndexService = $this->tester->grabService(SearchIndexServiceInterface::class); + $searchIndexService->createIndex('test_index'); + $stats = $searchIndexService->getStats('test_index'); + $this->assertArrayHasKey('indices', $stats); + $this->assertArrayHasKey('test_index', $stats['indices']); + $searchIndexService->deleteIndex('test_index'); + } +} diff --git a/tests/Functional/OpenSearch/LocateInTreeServiceTest.php b/tests/Functional/DefaultSearch/LocateInTreeServiceTest.php similarity index 99% rename from tests/Functional/OpenSearch/LocateInTreeServiceTest.php rename to tests/Functional/DefaultSearch/LocateInTreeServiceTest.php index b7260978..d85dcb91 100644 --- a/tests/Functional/OpenSearch/LocateInTreeServiceTest.php +++ b/tests/Functional/DefaultSearch/LocateInTreeServiceTest.php @@ -13,7 +13,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Functional\OpenSearch; +namespace Functional\DefaultSearch; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\AssetSearch; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\DataObject\DataObjectSearch; diff --git a/tests/Functional/OpenSearch/OpenSearchServiceTest.php b/tests/Functional/OpenSearch/OpenSearchServiceTest.php deleted file mode 100644 index c0766ce4..00000000 --- a/tests/Functional/OpenSearch/OpenSearchServiceTest.php +++ /dev/null @@ -1,274 +0,0 @@ -tester->flushIndex(); - $this->tester->cleanupIndex(); - $this->tester->flushIndex(); - } - - // tests - - public function testRefreshIndex(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('testindex'); - $openSearchClient->create(['index' => 'testindex', 'refresh' => false, 'id'=>1, 'body' => ['test' => 'test']]); - $openSearchService->refreshIndex('testindex'); - $this->assertEquals('test', $openSearchClient->get(['index' => 'testindex', 'id' => 1])['_source']['test']); - $openSearchService->deleteIndex('testindex'); - } - - public function testDeleteIndex(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('testindex'); - $this->assertTrue($openSearchClient->indices()->exists(['index' => 'testindex'])); - $openSearchService->deleteIndex('testindex'); - $this->assertFalse($openSearchClient->indices()->exists(['index' => 'testindex'])); - } - - public function testGetCurrentIndexVersion(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - - $openSearchService->createIndex('test_index-odd'); - $openSearchService->addAlias('test_index', 'test_index-odd'); - $this->assertEquals('odd', $openSearchService->getCurrentIndexVersion('test_index')); - - $openSearchService->deleteIndex('test_index-odd'); - - $openSearchService->createIndex('test_index-even'); - $openSearchService->addAlias('test_index', 'test_index-even'); - $this->assertEquals('even', $openSearchService->getCurrentIndexVersion('test_index')); - $openSearchService->deleteIndex('test_index-even'); - } - - public function testReindex(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - - $openSearchService->createIndex('test_index-odd', ['test'=> ['type'=>'object']]); - $openSearchService->addAlias('test_index', 'test_index-odd'); - $openSearchService->reindex('test_index', ['test'=> ['type'=>'keyword']]); - - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - $mapping = $openSearchClient->indices()->getMapping(['index' => 'test_index']); - $this->assertEquals('keyword', $mapping['test_index-even']['mappings']['properties']['test']['type']); - - $openSearchService->deleteIndex('test_index-even'); - } - - public function testCreateIndex(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('test_index', ['test'=> ['type'=>'object']]); - $mapping = $openSearchClient->indices()->getMapping(['index' => 'test_index']); - $this->assertEquals('object', $mapping['test_index']['mappings']['properties']['test']['type']); - $openSearchService->deleteIndex('test_index'); - } - - public function testAddAlias(): void - { - - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('test_index'); - $openSearchService->createIndex('test_index2'); - $openSearchService->addAlias('test_index_alias', 'test_index'); - $openSearchService->addAlias('test_index_alias', 'test_index2'); - $this->assertTrue($openSearchClient->indices()->existsAlias(['name' => 'test_index_alias', 'index' => 'test_index'])); - $this->assertTrue($openSearchClient->indices()->existsAlias(['name' => 'test_index_alias', 'index' => 'test_index2'])); - $openSearchService->deleteIndex('test_index'); - $openSearchService->deleteIndex('test_index2'); - - } - - public function testExistsAlias(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - - $openSearchService->createIndex('test_index'); - $openSearchService->addAlias('test_index_alias', 'test_index'); - - $this->assertTrue($openSearchService->existsAlias('test_index_alias', 'test_index')); - $this->assertFalse($openSearchService->existsAlias('test_index_alias', 'test_index2')); - $this->assertFalse($openSearchService->existsAlias('test_index_alias2', 'test_index')); - - $openSearchService->deleteIndex('test_index'); - } - - public function testExistsIndex(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - - $openSearchService->createIndex('test_index'); - $this->assertTrue($openSearchService->existsIndex('test_index')); - $this->assertFalse($openSearchService->existsIndex('test_index2')); - $openSearchService->deleteIndex('test_index'); - } - - public function testDeleteAlias(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - - $openSearchService->createIndex('test_index'); - $openSearchService->addAlias('test_index_alias', 'test_index'); - $this->assertTrue($openSearchService->existsAlias('test_index_alias', 'test_index')); - $openSearchService->deleteAlias('test_index', 'test_index_alias'); - $this->assertFalse($openSearchService->existsAlias('test_index_alias', 'test_index')); - $openSearchService->deleteIndex('test_index'); - } - - public function testGetDocument(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('test_index'); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>1, 'body' => ['test' => 'test']]); - $document = $openSearchService->getDocument('test_index', 1); - $this->assertEquals('test', $document['_source']['test']); - $document = $openSearchService->getDocument('test_index', 2, true); - $this->assertFalse($document['found']); - $openSearchService->deleteIndex('test_index'); - $this->expectException(Missing404Exception::class); - $openSearchService->getDocument('test_index', 2); - } - - public function testPutMapping(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('test_index'); - $openSearchService->putMapping([ - 'index' => 'test_index', - 'body' => ['properties' => ['test' => ['type' => 'keyword']]], - ]); - - $mapping = $openSearchClient->indices()->getMapping(['index' => 'test_index']); - $this->assertEquals('keyword', $mapping['test_index']['mappings']['properties']['test']['type']); - $openSearchService->deleteIndex('test_index'); - } - - public function testCountByAttributeValue(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('test_index'); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>1, 'body' => ['test' => 'test']]); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>2, 'body' => ['test' => 'test']]); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>3, 'body' => ['test' => 'test']]); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>4, 'body' => ['test' => 'test2']]); - - $this->assertEquals(3, $openSearchService->countByAttributeValue('test_index', 'test', 'test')); - $this->assertEquals(1, $openSearchService->countByAttributeValue('test_index', 'test', 'test2')); - $this->assertEquals(0, $openSearchService->countByAttributeValue('test_index', 'test', 'test3')); - $openSearchService->deleteIndex('test_index'); - } - - public function testSearch(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - /** @var Client $openSearchClient */ - $openSearchClient = $this->tester->grabService('generic-data-index.opensearch-client'); - - $openSearchService->createIndex('test_index'); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>1, 'body' => ['test' => 'test']]); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>2, 'body' => ['test' => 'test']]); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>3, 'body' => ['test' => 'test']]); - $openSearchClient->create(['index' => 'test_index', 'refresh' => true, 'id'=>4, 'body' => ['test' => 'test2']]); - - /** @var Search $search */ - $search = $openSearchService->createPaginatedSearch(1, 2); - $search->addQuery(new TermFilter('test', 'test')); - $this->assertEquals(2, $search->getSize()); - $this->assertEquals(0, $search->getFrom()); - - $result = $openSearchService->search($search, 'test_index'); - $this->assertEquals(3, $result->getTotalHits()); - $this->assertCount(2, $result->getHits()); - - $this->assertCount(1, $openSearchService->getExecutedSearches()); - $searchInformation = $openSearchService->getExecutedSearches()[0]; - $this->assertEquals($search, $searchInformation->getSearch()); - $this->assertTrue($searchInformation->isSuccess()); - $this->assertEquals($searchInformation->getResponse()['hits']['total']['value'], $result->getTotalHits()); - $this->assertIsNumeric($searchInformation->getExecutionTime()); - $this->assertNotEmpty($searchInformation->getStackTrace()); - - $openSearchService->deleteIndex('test_index'); - } - - public function getTestGetStats(): void - { - /** @var OpenSearchService $openSearchService */ - $openSearchService = $this->tester->grabService(SearchIndexServiceInterface::class); - $openSearchService->createIndex('test_index'); - $stats = $openSearchService->getStats('test_index'); - $this->assertArrayHasKey('indices', $stats); - $this->assertArrayHasKey('test_index', $stats['indices']); - $openSearchService->deleteIndex('test_index'); - } -} diff --git a/tests/Functional/Search/Modifier/Filter/AssetMetadataFilterTest.php b/tests/Functional/Search/Modifier/Filter/AssetMetadataFilterTest.php index 7f469925..1d942b25 100644 --- a/tests/Functional/Search/Modifier/Filter/AssetMetadataFilterTest.php +++ b/tests/Functional/Search/Modifier/Filter/AssetMetadataFilterTest.php @@ -15,7 +15,7 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Functional\Search\Modifier\Filter; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\DateFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\Asset\AssetSearchServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\SearchProviderInterface; diff --git a/tests/Functional/Search/Modifier/Sort/SortModifierTest.php b/tests/Functional/Search/Modifier/Sort/SortModifierTest.php index b48e6fc7..299c32c5 100644 --- a/tests/Functional/Search/Modifier/Sort/SortModifierTest.php +++ b/tests/Functional/Search/Modifier/Sort/SortModifierTest.php @@ -17,12 +17,12 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Enum\Search\SortDirection; -use Pimcore\Bundle\GenericDataIndexBundle\Exception\OpenSearch\ResultWindowTooLargeException; -use Pimcore\Bundle\GenericDataIndexBundle\Exception\OpenSearch\SearchFailedException; +use Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch\ResultWindowTooLargeException; +use Pimcore\Bundle\GenericDataIndexBundle\Exception\DefaultSearch\SearchFailedException; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\OrderByField; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\Tree\OrderByFullPath; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Sort\Tree\OrderByIndexField; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Sort\TreeSortHandlers; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Sort\TreeSortHandlers; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\Asset\AssetSearchServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\DataObject\DataObjectSearchServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\SearchProviderInterface; diff --git a/tests/Functional/SearchIndex/AssetBasicTest.php b/tests/Functional/SearchIndex/AssetBasicTest.php index 8b24c193..99427c71 100644 --- a/tests/Functional/SearchIndex/AssetBasicTest.php +++ b/tests/Functional/SearchIndex/AssetBasicTest.php @@ -15,7 +15,6 @@ namespace Functional\SearchIndex; -use OpenSearch\Common\Exceptions\Missing404Exception; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Document; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Folder; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Image; @@ -69,9 +68,7 @@ public function testAssetIndexing() $this->assertEquals('test.jpg', $response['_source']['system_fields']['key']); $asset->delete(); - - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($asset->getId(), $indexName); + $this->tester->checkDeletedIndexEntry($asset->getId(), $indexName); } diff --git a/tests/Functional/SearchIndex/DataObjectBasicTest.php b/tests/Functional/SearchIndex/DataObjectBasicTest.php index 07d46590..e19ca39f 100644 --- a/tests/Functional/SearchIndex/DataObjectBasicTest.php +++ b/tests/Functional/SearchIndex/DataObjectBasicTest.php @@ -15,7 +15,6 @@ namespace Functional\SearchIndex; -use OpenSearch\Common\Exceptions\Missing404Exception; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexName; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\DataObject\DataObjectSearchServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\SearchProviderInterface; @@ -71,9 +70,7 @@ public function testIndexingWithInheritanceSynchronous() $this->assertEquals('my-test-object', $response['_source']['system_fields']['key']); $object->delete(); - - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($object->getId(), $indexName); + $this->tester->checkDeletedIndexEntry($object->getId(), $indexName); } public function testIndexingWithInheritanceAsynchronous() @@ -83,13 +80,10 @@ public function testIndexingWithInheritanceAsynchronous() $object = $this->createObjectWithInheritance(); $indexName = $this->searchIndexConfigService->getIndexName($object->getClassName()); - // check indexed - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($object->getId(), $indexName); - - $this->assertNotEmpty( + $this->assertGreaterThan( + 0, Db::get()->fetchOne( - 'select count(elementId) from generic_data_index_queue where elementId = ? and elementType="object"', + 'select count(elementId) from generic_data_index_queue where elementId = ? and elementType="dataObject"', [$object->getId()] ) ); @@ -115,9 +109,7 @@ public function testIndexingWithoutInheritanceSynchronous() $this->assertEquals('my-test-object', $response['_source']['system_fields']['key']); $object->delete(); - - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($object->getId(), $indexName); + $this->tester->checkDeletedIndexEntry($object->getId(), $indexName); } public function testIndexingWithoutInheritanceAsynchronous() @@ -127,14 +119,10 @@ public function testIndexingWithoutInheritanceAsynchronous() $object = TestHelper::createEmptyObject(); $this->assertFalse($object->getClass()->getAllowInherit()); $indexName = $this->searchIndexConfigService->getIndexName($object->getClassName()); - - // check indexed - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($object->getId(), $indexName); - - $this->assertNotEmpty( + $this->assertGreaterThan( + 0, Db::get()->fetchOne( - 'select count(elementId) from generic_data_index_queue where elementId = ? and elementType="object"', + 'select count(elementId) from generic_data_index_queue where elementId = ? and elementType="dataObject"', [$object->getId()] ) ); @@ -160,9 +148,7 @@ public function testFolderIndexing() $this->assertEquals('my-test-folder', $response['_source']['system_fields']['key']); $object->delete(); - - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($object->getId(), $indexName); + $this->tester->checkDeletedIndexEntry($object->getId(), $indexName); } public function testDataObjectSearch() diff --git a/tests/Functional/SearchIndex/DocumentBasicTest.php b/tests/Functional/SearchIndex/DocumentBasicTest.php index bd80c9c5..90c09972 100644 --- a/tests/Functional/SearchIndex/DocumentBasicTest.php +++ b/tests/Functional/SearchIndex/DocumentBasicTest.php @@ -18,7 +18,6 @@ use Codeception\Test\Unit; use Exception; -use OpenSearch\Common\Exceptions\Missing404Exception; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Email; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\Folder; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\SearchResult\SearchResultItem\HardLink; @@ -72,9 +71,7 @@ public function testDocumentIndexing() $this->assertEquals($document->getKey(), $response['_source']['system_fields']['key']); $document->delete(); - - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($documentId, $indexName); + $this->tester->checkDeletedIndexEntry($documentId, $indexName); } /** diff --git a/tests/Functional/SearchIndex/IndexQueueTest.php b/tests/Functional/SearchIndex/IndexQueueTest.php index 04aa188f..59c83243 100644 --- a/tests/Functional/SearchIndex/IndexQueueTest.php +++ b/tests/Functional/SearchIndex/IndexQueueTest.php @@ -17,7 +17,6 @@ use Codeception\Test\Unit; use Exception; -use OpenSearch\Common\Exceptions\Missing404Exception; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ElementType; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexName; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexQueueOperation; @@ -107,9 +106,7 @@ public function testAssetSaveNotEnqueued(): void $indexName = $this->searchIndexConfigService->getIndexName(self::ASSET_INDEX_NAME); $asset = TestHelper::createImageAsset(); - - $this->expectException(Missing404Exception::class); - $this->tester->checkIndexEntry($asset->getId(), $indexName); + $this->tester->checkDeletedIndexEntry($asset->getId(), $indexName); } public function testAssetSaveProcessQueue(): void @@ -122,7 +119,8 @@ public function testAssetSaveProcessQueue(): void $asset = TestHelper::createImageAsset(); - $this->assertNotEmpty( + $this->assertGreaterThan( + 0, Db::get()->fetchOne( 'select count(elementId) from generic_data_index_queue where elementId = ? and elementType="asset"', [$asset->getId()] diff --git a/tests/Support/Helper/GenericDataIndex.php b/tests/Support/Helper/GenericDataIndex.php index c9f82e49..515c3c0e 100644 --- a/tests/Support/Helper/GenericDataIndex.php +++ b/tests/Support/Helper/GenericDataIndex.php @@ -19,16 +19,16 @@ // all public methods declared in helper class will be available in $I use Codeception\Lib\ModuleContainer; -use OpenSearch\Client; use Pimcore\Bundle\GenericDataIndexBundle\Installer; use Pimcore\Bundle\GenericDataIndexBundle\Installer as GenericDataIndexInstaller; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Search\Modifier\Sort\TreeSortHandlers; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Search\Modifier\Sort\TreeSortHandlers; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexQueue\QueueMessagesDispatcher; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexQueue\SynchronousProcessingServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexUpdateServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Console\Application; use Pimcore\Db; +use Pimcore\SearchClient\SearchClientInterface; use Pimcore\Tests\Support\Helper\Pimcore; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -129,26 +129,26 @@ public function disableSynchronousProcessing(): void public function getIndexSearchClient(): mixed { - return $this->grabService('generic-data-index.opensearch-client'); + return $this->grabService('generic-data-index.search-client'); } public function checkIndexEntry(string $id, string $index): array { - - /** @var Client $client */ + /** @var SearchClientInterface $client */ $client = $this->getIndexSearchClient(); $response = $client->get([ 'id' => $id, 'index' => $index, ]); - $this->assertEquals($id, $response['_id'], 'Check OpenSearch document id of element'); + $this->assertEquals($id, $response['_id'], 'Check indexed document id of element'); return $response; } public function checkDeletedIndexEntry(string $id, string $index): void { + /** @var SearchClientInterface $client */ $client = $this->getIndexSearchClient(); $response = $client->get([ 'id' => $id, @@ -167,13 +167,15 @@ public function checkDeletedIndexEntry(string $id, string $index): void public function flushIndex() { + /** @var SearchClientInterface $client */ $client = $this->getIndexSearchClient(); - $client->indices()->refresh(); - $client->indices()->flush(); + $client->refreshIndex(); + $client->flushIndex(); } public function cleanupIndex() { + /** @var SearchClientInterface $client */ $client = $this->getIndexSearchClient(); $client->deleteByQuery([ 'index' => '*', @@ -189,10 +191,10 @@ public function setIndexResultWindow( string $indexName, int $windowSize = 10000): void { - /** @var Client $client */ + /** @var SearchClientInterface $client */ $client = $this->getIndexSearchClient(); - $client->indices()->putSettings([ + $client->putIndexSettings([ 'index' => $indexName, 'body' => [ 'max_result_window' => $windowSize, @@ -231,8 +233,9 @@ public function getIndexName(string $name): string { $searchIndexConfigService = $this->grabService(SearchIndexConfigServiceInterface::class); $indexName = $searchIndexConfigService->getIndexName($name); + /** @var SearchClientInterface $client */ $client = $this->getIndexSearchClient(); - $alias = $client->indices()->getAlias([ + $alias = $client->getIndexAlias([ 'name' => $indexName, ]); @@ -241,8 +244,9 @@ public function getIndexName(string $name): string public function getIndexMapping(string $indexName): array { + /** @var SearchClientInterface $client */ $client = $this->getIndexSearchClient(); - return $client->indices()->getMapping(['index' => $indexName]); + return $client->getIndexMapping(['index' => $indexName]); } } diff --git a/tests/Unit/Model/OpenSearch/Query/BoolQueryTest.php b/tests/Unit/Model/DefaultSearch/Query/BoolQueryTest.php similarity index 94% rename from tests/Unit/Model/OpenSearch/Query/BoolQueryTest.php rename to tests/Unit/Model/DefaultSearch/Query/BoolQueryTest.php index f3cde1c1..1b282c65 100644 --- a/tests/Unit/Model/OpenSearch/Query/BoolQueryTest.php +++ b/tests/Unit/Model/DefaultSearch/Query/BoolQueryTest.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Query; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Query; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermsFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermsFilter; /** * @internal diff --git a/tests/Unit/Model/OpenSearch/Query/DateFilterTest.php b/tests/Unit/Model/DefaultSearch/Query/DateFilterTest.php similarity index 98% rename from tests/Unit/Model/OpenSearch/Query/DateFilterTest.php rename to tests/Unit/Model/DefaultSearch/Query/DateFilterTest.php index 4587bd33..216d1bc6 100644 --- a/tests/Unit/Model/OpenSearch/Query/DateFilterTest.php +++ b/tests/Unit/Model/DefaultSearch/Query/DateFilterTest.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Query; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Query; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\DateFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter; /** * @internal diff --git a/tests/Unit/Model/OpenSearch/Query/QueryListTest.php b/tests/Unit/Model/DefaultSearch/Query/QueryListTest.php similarity index 93% rename from tests/Unit/Model/OpenSearch/Query/QueryListTest.php rename to tests/Unit/Model/DefaultSearch/Query/QueryListTest.php index 466d2f23..9ff999b7 100644 --- a/tests/Unit/Model/OpenSearch/Query/QueryListTest.php +++ b/tests/Unit/Model/DefaultSearch/Query/QueryListTest.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Query; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Query; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\BoolQuery; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\Query; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\QueryList; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\BoolQuery; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\Query; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\QueryList; /** * @internal diff --git a/tests/Unit/Model/OpenSearch/Query/QueryTest.php b/tests/Unit/Model/DefaultSearch/Query/QueryTest.php similarity index 93% rename from tests/Unit/Model/OpenSearch/Query/QueryTest.php rename to tests/Unit/Model/DefaultSearch/Query/QueryTest.php index 55da646c..3d842d3f 100644 --- a/tests/Unit/Model/OpenSearch/Query/QueryTest.php +++ b/tests/Unit/Model/DefaultSearch/Query/QueryTest.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Query; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Query; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\Query; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\Query; /** * @internal diff --git a/tests/Unit/Model/OpenSearch/Query/TermFilterTest.php b/tests/Unit/Model/DefaultSearch/Query/TermFilterTest.php similarity index 92% rename from tests/Unit/Model/OpenSearch/Query/TermFilterTest.php rename to tests/Unit/Model/DefaultSearch/Query/TermFilterTest.php index 6d28feb7..b5fce8ce 100644 --- a/tests/Unit/Model/OpenSearch/Query/TermFilterTest.php +++ b/tests/Unit/Model/DefaultSearch/Query/TermFilterTest.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Query; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Query; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermFilter; /** * @internal diff --git a/tests/Unit/Model/OpenSearch/Query/TermsFilterTest.php b/tests/Unit/Model/DefaultSearch/Query/TermsFilterTest.php similarity index 92% rename from tests/Unit/Model/OpenSearch/Query/TermsFilterTest.php rename to tests/Unit/Model/DefaultSearch/Query/TermsFilterTest.php index d28d90de..afb2f6b1 100644 --- a/tests/Unit/Model/OpenSearch/Query/TermsFilterTest.php +++ b/tests/Unit/Model/DefaultSearch/Query/TermsFilterTest.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Query; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Query; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\TermsFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\TermsFilter; /** * @internal diff --git a/tests/Unit/Model/OpenSearch/Query/WildcardFilterTest.php b/tests/Unit/Model/DefaultSearch/Query/WildcardFilterTest.php similarity index 95% rename from tests/Unit/Model/OpenSearch/Query/WildcardFilterTest.php rename to tests/Unit/Model/DefaultSearch/Query/WildcardFilterTest.php index f069bdf6..f75b7b6e 100644 --- a/tests/Unit/Model/OpenSearch/Query/WildcardFilterTest.php +++ b/tests/Unit/Model/DefaultSearch/Query/WildcardFilterTest.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Query; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Query; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\WildcardFilterMode; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\WildcardFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\WildcardFilterMode; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\WildcardFilter; /** * @internal diff --git a/tests/Unit/Model/OpenSearch/Search/Asset/AssetSearchTest.php b/tests/Unit/Model/DefaultSearch/Search/Asset/AssetSearchTest.php similarity index 97% rename from tests/Unit/Model/OpenSearch/Search/Asset/AssetSearchTest.php rename to tests/Unit/Model/DefaultSearch/Search/Asset/AssetSearchTest.php index 8d0edc55..305ed3b7 100644 --- a/tests/Unit/Model/OpenSearch/Search/Asset/AssetSearchTest.php +++ b/tests/Unit/Model/DefaultSearch/Search/Asset/AssetSearchTest.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Search\Asset; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Search\Asset; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\AssetSearch; diff --git a/tests/Unit/Model/OpenSearch/Search/DataObject/DataObjectSearchTest.php b/tests/Unit/Model/DefaultSearch/Search/DataObject/DataObjectSearchTest.php similarity index 98% rename from tests/Unit/Model/OpenSearch/Search/DataObject/DataObjectSearchTest.php rename to tests/Unit/Model/DefaultSearch/Search/DataObject/DataObjectSearchTest.php index 2eed6222..94d2a94f 100644 --- a/tests/Unit/Model/OpenSearch/Search/DataObject/DataObjectSearchTest.php +++ b/tests/Unit/Model/DefaultSearch/Search/DataObject/DataObjectSearchTest.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Search\DataObject; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Search\DataObject; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\DataObject\DataObjectSearch; diff --git a/tests/Unit/Model/OpenSearch/Search/Document/DocumentSearchTest.php b/tests/Unit/Model/DefaultSearch/Search/Document/DocumentSearchTest.php similarity index 97% rename from tests/Unit/Model/OpenSearch/Search/Document/DocumentSearchTest.php rename to tests/Unit/Model/DefaultSearch/Search/Document/DocumentSearchTest.php index 04479cd3..2e686d4b 100644 --- a/tests/Unit/Model/OpenSearch/Search/Document/DocumentSearchTest.php +++ b/tests/Unit/Model/DefaultSearch/Search/Document/DocumentSearchTest.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Search\Document; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Search\Document; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Document\DocumentSearch; diff --git a/tests/Unit/Model/OpenSearch/Search/SearchModifierContextTest.php b/tests/Unit/Model/DefaultSearch/Search/SearchModifierContextTest.php similarity index 79% rename from tests/Unit/Model/OpenSearch/Search/SearchModifierContextTest.php rename to tests/Unit/Model/DefaultSearch/Search/SearchModifierContextTest.php index 29e7a4e0..bbf6121e 100644 --- a/tests/Unit/Model/OpenSearch/Search/SearchModifierContextTest.php +++ b/tests/Unit/Model/DefaultSearch/Search/SearchModifierContextTest.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Search; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Search; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Modifier\SearchModifierContext; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\OpenSearchSearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\DefaultSearchInterface; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Modifier\SearchModifierContext; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface; /** @@ -28,7 +28,7 @@ final class SearchModifierContextTest extends Unit { public function testGetSearch(): void { - $searchMock = $this->makeEmpty(OpenSearchSearchInterface::class); + $searchMock = $this->makeEmpty(DefaultSearchInterface::class); $assetSearchMock = $this->makeEmpty(SearchInterface::class); $searchModifierContext = new SearchModifierContext($searchMock, $assetSearchMock); diff --git a/tests/Unit/Model/OpenSearch/Search/Traits/PaginatedSearchTraitTest.php b/tests/Unit/Model/DefaultSearch/Search/Traits/PaginatedSearchTraitTest.php similarity index 98% rename from tests/Unit/Model/OpenSearch/Search/Traits/PaginatedSearchTraitTest.php rename to tests/Unit/Model/DefaultSearch/Search/Traits/PaginatedSearchTraitTest.php index d21f85b4..e585e0cf 100644 --- a/tests/Unit/Model/OpenSearch/Search/Traits/PaginatedSearchTraitTest.php +++ b/tests/Unit/Model/DefaultSearch/Search/Traits/PaginatedSearchTraitTest.php @@ -14,7 +14,7 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\OpenSearch\Search\Traits; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\Model\DefaultSearch\Search\Traits; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidModifierException; diff --git a/tests/Unit/QueryLanguage/Pql/ParserTest.php b/tests/Unit/QueryLanguage/Pql/ParserTest.php index 06648b61..b1f33627 100644 --- a/tests/Unit/QueryLanguage/Pql/ParserTest.php +++ b/tests/Unit/QueryLanguage/Pql/ParserTest.php @@ -22,8 +22,8 @@ use Pimcore\Bundle\GenericDataIndexBundle\Model\QueryLanguage\ParseResultSubQuery; use Pimcore\Bundle\GenericDataIndexBundle\QueryLanguage\Pql\Lexer; use Pimcore\Bundle\GenericDataIndexBundle\QueryLanguage\Pql\Parser; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\PqlAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\SubQueriesProcessorInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\PqlAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\SubQueriesProcessorInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\ElementServiceInterface; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexEntityService; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; diff --git a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/BooleanAdapterTest.php b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/BooleanAdapterTest.php index 569478f5..f8dd40d8 100644 --- a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/BooleanAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/BooleanAdapterTest.php @@ -18,9 +18,9 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\BooleanAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\BooleanAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** diff --git a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/DateAdapterTest.php b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/DateAdapterTest.php index 7440d0d4..12f287e9 100644 --- a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/DateAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/DateAdapterTest.php @@ -18,10 +18,10 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Query\DateFilter; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Query\DateFilter; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\DateAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\DateAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** diff --git a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/KeywordAdapterTest.php b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/KeywordAdapterTest.php index d165eb6d..f92b14dc 100644 --- a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/KeywordAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/KeywordAdapterTest.php @@ -18,9 +18,9 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\KeywordAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\KeywordAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -28,7 +28,7 @@ */ final class KeywordAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $adapter = new KeywordAdapter( diff --git a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/RelationAdapterTest.php b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/RelationAdapterTest.php index 21ff4903..b2ca47d1 100644 --- a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/RelationAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/RelationAdapterTest.php @@ -18,9 +18,9 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\RelationAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\RelationAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\Asset\Image; diff --git a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/TextKeywordAdapterTest.php b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/TextKeywordAdapterTest.php index fd3601ee..eb4a131e 100644 --- a/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/TextKeywordAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/Asset/FieldDefinitionAdapter/TextKeywordAdapterTest.php @@ -18,10 +18,10 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Exception\InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Search; +use Pimcore\Bundle\GenericDataIndexBundle\Model\DefaultSearch\Search; use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Modifier\Filter\Asset\AssetMetaDataFilter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\TextKeywordAdapter; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\TextKeywordAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -29,7 +29,7 @@ */ final class TextKeywordAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $indexMappingServiceInterfaceMock = $this->getMappingService( diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedImageAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedImageAdapterTest.php index ab09a1c0..d152d05e 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedImageAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedImageAdapterTest.php @@ -17,10 +17,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DataObject\FieldDefinitionAdapter; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\AdvancedImageAdapter; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\AdvancedImageAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Hotspotimage; @@ -29,7 +29,7 @@ */ final class AdvancedImageAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapterTest.php index 54082940..ff5990d0 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/AdvancedManyToManyRelationAdapterTest.php @@ -18,9 +18,9 @@ use Codeception\Test\Unit; use InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\AdvancedManyToManyRelationAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\AdvancedManyToManyRelationAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\AdvancedManyToManyRelation; use Pimcore\Model\DataObject\ClassDefinition\Data\Checkbox; @@ -30,7 +30,7 @@ */ final class AdvancedManyToManyRelationAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); @@ -98,7 +98,7 @@ public function testGetOpenSearchMapping(): void ], $adapter->getIndexMapping()); } - public function testGetOpenSearchMappingException(): void + public function testGetSearchIndexMappingException(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/BooleanAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/BooleanAdapterTest.php index 76ff4b66..e8286188 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/BooleanAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/BooleanAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\BooleanAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\BooleanAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class BooleanAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapterTest.php index be2bcbac..7bcbb822 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapterTest.php @@ -19,7 +19,7 @@ use Codeception\Test\Unit; use InvalidArgumentException; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ClassificationStoreAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ClassificationStoreAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Checkbox; use Pimcore\Model\DataObject\ClassDefinition\Data\Classificationstore; diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ConsentAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ConsentAdapterTest.php index 54e43cce..3b82172d 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ConsentAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ConsentAdapterTest.php @@ -17,9 +17,9 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DataObject\FieldDefinitionAdapter; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ConsentAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ConsentAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Consent; @@ -28,7 +28,7 @@ */ final class ConsentAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateAdapterTest.php index 409763a4..6ede0025 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\DateAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\DateAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Date; @@ -27,7 +27,7 @@ */ final class DateAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateRangeAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateRangeAdapterTest.php index 7acb4727..4ec43b99 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateRangeAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DateRangeAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\DateRangeAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\DateRangeAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class DateRangeAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DatetimeAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DatetimeAdapterTest.php index d4b1d09e..a221a95b 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DatetimeAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/DatetimeAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\DatetimeAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\DatetimeAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Datetime; @@ -27,7 +27,7 @@ */ final class DatetimeAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ExternalImageAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ExternalImageAdapterTest.php index a3cc943d..f6dcd830 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ExternalImageAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ExternalImageAdapterTest.php @@ -17,9 +17,9 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DataObject\FieldDefinitionAdapter; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ExternalImageAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ExternalImageAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\ExternalImage; @@ -28,7 +28,7 @@ */ final class ExternalImageAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/FieldCollectionAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/FieldCollectionAdapterTest.php index 41848579..a898ff8f 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/FieldCollectionAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/FieldCollectionAdapterTest.php @@ -18,9 +18,9 @@ use Codeception\Test\Unit; use InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\FieldCollectionAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\FieldCollectionAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Bundle\StaticResolverBundle\Models\DataObject\FieldCollection\DefinitionResolverInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Checkbox; @@ -29,7 +29,7 @@ class FieldCollectionAdapterTest extends Unit { - public function testOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapterTest.php index 2c70f747..c69f4696 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicBoundsAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\GeographicBoundsAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\GeographicBoundsAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class GeographicBoundsAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicPointAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicPointAdapterTest.php index 4a4e5053..5b627f0b 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicPointAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/GeographicPointAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\GeographicPointAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\GeographicPointAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class GeographicPointAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageAdapterTest.php index f4a976a1..d8b6e3ee 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageAdapterTest.php @@ -17,9 +17,9 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DataObject\FieldDefinitionAdapter; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ImageAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ImageAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Image; @@ -28,7 +28,7 @@ */ final class ImageAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageGalleryAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageGalleryAdapterTest.php index 6e780ece..73c73755 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageGalleryAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ImageGalleryAdapterTest.php @@ -17,10 +17,10 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DataObject\FieldDefinitionAdapter; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ImageGalleryAdapter; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ImageGalleryAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\ImageGallery; @@ -29,7 +29,7 @@ */ final class ImageGalleryAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/LinkAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/LinkAdapterTest.php index 6e14c871..9465e6db 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/LinkAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/LinkAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\LinkAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\LinkAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class LinkAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericAdapterTest.php index 267eae72..fc344b9b 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\NumericAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\NumericAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class NumericAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericRangeAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericRangeAdapterTest.php index 587e0bdc..ad296999 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericRangeAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/NumericRangeAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\NumericRangeAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\NumericRangeAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ObjectBrickAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ObjectBrickAdapterTest.php index 2a21108a..0988adca 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ObjectBrickAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/ObjectBrickAdapterTest.php @@ -19,7 +19,7 @@ use Codeception\Test\Unit; use InvalidArgumentException; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\ObjectBrickAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\ObjectBrickAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Input; diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueAdapterTest.php index 851befe7..efd08dae 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\QuantityValueAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\QuantityValueAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class QuantityValueAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapterTest.php index 18fd4a64..bb245eb3 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/QuantityValueRangeAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\QuantityValueRangeAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\QuantityValueRangeAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class QuantityValueRangeAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RelationAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RelationAdapterTest.php index 7938b863..3a3c5d94 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RelationAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RelationAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\RelationAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\RelationAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\Asset\Image; use Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyRelation; @@ -30,7 +30,7 @@ */ final class RelationAdapterTest extends Unit { - public function testOpenSearchMapping() + public function testGetSearchIndexMapping() { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RgbaColorAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RgbaColorAdapterTest.php index e7faa02a..dccf2091 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RgbaColorAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/RgbaColorAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\RgbaColorAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\RgbaColorAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class RgbaColorAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/StructuredTableAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/StructuredTableAdapterTest.php index c8548d39..d2cd2043 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/StructuredTableAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/StructuredTableAdapterTest.php @@ -18,9 +18,9 @@ use Codeception\Test\Unit; use InvalidArgumentException; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\StructuredTableAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\StructuredTableAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Checkbox; use Pimcore\Model\DataObject\ClassDefinition\Data\StructuredTable; @@ -30,7 +30,7 @@ */ final class StructuredTableAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); @@ -103,7 +103,7 @@ public function testGetOpenSearchMapping(): void ], $adapter->getIndexMapping()); } - public function testGetOpenSearchMappingException(): void + public function testGetSearchIndexMappingException(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TextKeywordAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TextKeywordAdapterTest.php index a4b70acc..b1cf11c7 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TextKeywordAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TextKeywordAdapterTest.php @@ -18,8 +18,8 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\TextKeywordAdapter; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\IndexMappingServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\TextKeywordAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -27,7 +27,7 @@ */ final class TextKeywordAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TimeAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TimeAdapterTest.php index 00c63ccb..6d4f90b1 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TimeAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/TimeAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\TimeAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\TimeAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class TimeAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/UrlSlugAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/UrlSlugAdapterTest.php index 65eaa07c..dc401e1b 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/UrlSlugAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/UrlSlugAdapterTest.php @@ -18,7 +18,7 @@ use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\UrlSlugAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\UrlSlugAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; /** @@ -26,7 +26,7 @@ */ final class UrlSlugAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/VideoAdapterTest.php b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/VideoAdapterTest.php index 44a33410..c18ce6c0 100644 --- a/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/VideoAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DataObject/FieldDefinitionAdapter/VideoAdapterTest.php @@ -17,9 +17,9 @@ namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DataObject\FieldDefinitionAdapter; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\VideoAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\VideoAdapter; use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\Asset; use Pimcore\Model\DataObject; @@ -30,7 +30,7 @@ */ final class VideoAdapterTest extends Unit { - public function testGetOpenSearchMapping(): void + public function testGetSearchIndexMapping(): void { $searchIndexConfigServiceInterfaceMock = $this->makeEmpty(SearchIndexConfigServiceInterface::class); $fieldDefinitionServiceInterfaceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/IndexMappingServiceTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/IndexMappingServiceTest.php similarity index 86% rename from tests/Unit/SearchIndexAdapter/OpenSearch/IndexMappingServiceTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/IndexMappingServiceTest.php index 44f60d59..d6450404 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/IndexMappingServiceTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/IndexMappingServiceTest.php @@ -14,13 +14,15 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\OpenSearch\AttributeType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\ClientType; +use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\DefaultSearch\AttributeType; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\AdapterInterface; use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DataObject\FieldDefinitionServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\IndexMappingService; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\IndexMappingService; +use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\SearchIndexConfigServiceInterface; use Pimcore\Model\DataObject\ClassDefinition\Data\Input; use Pimcore\Model\DataObject\ClassDefinition\Data\Localizedfields; @@ -32,7 +34,10 @@ final class IndexMappingServiceTest extends Unit public function testGetMappingWithEmptyFieldDefinitions(): void { $fieldDefinitionServiceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $this->assertSame( ['properties' => []], @@ -43,7 +48,10 @@ public function testGetMappingWithEmptyFieldDefinitions(): void public function testGetMappingWhenFieldDefinitionsHasNoName() { $fieldDefinitionServiceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $input = new Input(); @@ -58,7 +66,10 @@ public function testGetMappingWhenFieldDefinitionAdapterIsNotSet() $fieldDefinitionServiceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class, [ 'getFieldDefinitionAdapter' => null, ]); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $input = new Input(); $input->setName('test'); @@ -83,7 +94,10 @@ public function testGetMappingWithCorrectAdapter() $input = new Input(); $input->setName('testInput'); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $mapping = $indexMappingService->getMappingForFieldDefinitions([$input]); $this->assertSame( @@ -112,7 +126,10 @@ public function testTransformedLocalizedfields() $localizedfields = new Localizedfields(); $localizedfields->setName('localizedfields'); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $mapping = $indexMappingService->getMappingForFieldDefinitions([$localizedfields]); $this->assertSame( $this->getTransformedLocalizedFieldsMapping(), @@ -123,7 +140,10 @@ public function testTransformedLocalizedfields() public function testGetMappingForTextKeywordWithoutArguments(): void { $fieldDefinitionServiceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $this->assertSame( [ @@ -147,7 +167,10 @@ public function testGetMappingForTextKeywordWithoutArguments(): void public function testGetMappingForTextKeywordWithArguments(): void { $fieldDefinitionServiceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $attributes = [ 'text' => [ 'fields' => [ @@ -189,7 +212,10 @@ public function testGetMappingForTextKeywordWithArguments(): void public function testGetMappingForAdvancedImage(): void { $fieldDefinitionServiceMock = $this->makeEmpty(FieldDefinitionServiceInterface::class); - $indexMappingService = new IndexMappingService($fieldDefinitionServiceMock); + $indexMappingService = new IndexMappingService( + $fieldDefinitionServiceMock, + $this->getSearchIndexConfigServiceMock() + ); $keyWordMapping = $indexMappingService->getMappingForAdvancedImage([]); $this->assertSame( @@ -350,4 +376,11 @@ private function getTransformedLocalizedFieldsMapping(): array ], ]; } + + private function getSearchIndexConfigServiceMock(): SearchIndexConfigServiceInterface + { + return $this->makeEmpty(SearchIndexConfigServiceInterface::class, [ + 'getClientType' => ClientType::OPEN_SEARCH->value, + ]); + } } diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/MappingAnalyzerServiceTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/MappingAnalyzerServiceTest.php similarity index 97% rename from tests/Unit/SearchIndexAdapter/OpenSearch/MappingAnalyzerServiceTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/MappingAnalyzerServiceTest.php index 352d0c1c..a7e4e84e 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/MappingAnalyzerServiceTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/MappingAnalyzerServiceTest.php @@ -14,10 +14,10 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerService; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerService; /** * @internal diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformerTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformerTest.php similarity index 88% rename from tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformerTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformerTest.php index 142f3ae2..b6a9d77d 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformerTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/AssetMetadataDefaultLanguageTransformerTest.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\AssetMetadataDefaultLanguageTransformer; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\AssetMetadataDefaultLanguageTransformer; /** * @internal diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformerTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformerTest.php similarity index 85% rename from tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformerTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformerTest.php index 0cab5973..5e1d97c9 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformerTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/FieldCategoryTransformerTest.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\FieldCategoryTransformer; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\FieldCategoryTransformer; /** * @internal diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/IdTransformerTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/IdTransformerTest.php similarity index 84% rename from tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/IdTransformerTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/IdTransformerTest.php index f0072f70..8de8be9c 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/IdTransformerTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/IdTransformerTest.php @@ -14,11 +14,11 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\IdTransformer; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\IdTransformer; /** * @internal diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformerTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformerTest.php similarity index 86% rename from tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformerTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformerTest.php index 0a3ea59b..44489dd4 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformerTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/ImageGalleryTransformerTest.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexType; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\ImageGalleryTransformer; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\ImageGalleryTransformer; /** * @internal diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/RelationsTransformerTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/RelationsTransformerTest.php similarity index 88% rename from tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/RelationsTransformerTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/RelationsTransformerTest.php index 05737d3e..a3eb7455 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/RelationsTransformerTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/RelationsTransformerTest.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexType; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\MappingAnalyzerServiceInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\RelationsTransformer; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\MappingAnalyzerServiceInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\RelationsTransformer; /** * @internal diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SynonymTransformerTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SynonymTransformerTest.php similarity index 89% rename from tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SynonymTransformerTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SynonymTransformerTest.php index 12feb751..3660c5c3 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/FieldNameTransformer/SynonymTransformerTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/FieldNameTransformer/SynonymTransformerTest.php @@ -14,13 +14,13 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer; use Codeception\Test\Unit; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexName; use Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex\IndexType; use Pimcore\Bundle\GenericDataIndexBundle\Model\SearchIndex\IndexEntity; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformer\SynonymTransformer; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformer\SynonymTransformer; /** * @internal diff --git a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/PqlAdapterTest.php b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/PqlAdapterTest.php similarity index 84% rename from tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/PqlAdapterTest.php rename to tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/PqlAdapterTest.php index 0c23d8d5..ebd250b0 100644 --- a/tests/Unit/SearchIndexAdapter/OpenSearch/QueryLanguage/PqlAdapterTest.php +++ b/tests/Unit/SearchIndexAdapter/DefaultSearch/QueryLanguage/PqlAdapterTest.php @@ -14,12 +14,12 @@ * @license http://www.pimcore.org/license GPLv3 and PCL */ -namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\OpenSearch\QueryLanguage; +namespace Pimcore\Bundle\GenericDataIndexBundle\Tests\Unit\SearchIndexAdapter\DefaultSearch\QueryLanguage; use Codeception\Test\Unit; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\FieldNameTransformerInterface; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\PqlAdapter; -use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\QueryLanguage\SubQueriesProcessorInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\FieldNameTransformerInterface; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\PqlAdapter; +use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\QueryLanguage\SubQueriesProcessorInterface; /** * @internal diff --git a/tests/bin/docker-compose.yaml b/tests/bin/docker-compose.yaml index fc5f8930..ce4c2880 100644 --- a/tests/bin/docker-compose.yaml +++ b/tests/bin/docker-compose.yaml @@ -28,6 +28,23 @@ services: soft: 65536 hard: 65536 + elastic: + image: elasticsearch:8.5.3 + environment: + - discovery.type=single-node + - ES_JAVA_OPTS=-Xms1g -Xmx1g + - xpack.security.enabled=true + - xpack.security.authc.anonymous.roles=superuser,kibana_admin,kibana_system,kibana_user + - ELASTIC_USERNAME=elastic + - ELASTIC_PASSWORD=somethingsecret + ports: + - 5300:9200 + deploy: + resources: + limits: + cpus: '1' + memory: '2G' + php: #user: '1000:1000' # set to your uid:gid # image: pimcore/pimcore:PHP8.1-fpm-debug @@ -40,9 +57,11 @@ services: PIMCORE_TEST: 1 PIMCORE_TEST_DB_DSN: "mysql://pimcore:pimcore@db:3306/pimcore_test" PIMCORE_OPEN_SEARCH_HOST: "opensearch:9200" + PIMCORE_ELASTIC_SEARCH_HOST: "elastic:9200" CODECEPTION_BUNDLE_PATH: "bundles/pimcore/generic-data-index-bundle/" depends_on: - db + - elastic - opensearch volumes: - ../../.:/var/www/html/bundles/pimcore/generic-data-index-bundle diff --git a/tests/bin/init-functional-tests.sh b/tests/bin/init-functional-tests.sh index 92faac22..06c00f2e 100755 --- a/tests/bin/init-functional-tests.sh +++ b/tests/bin/init-functional-tests.sh @@ -2,15 +2,21 @@ if [ -z "$1" ] then - echo "No argument supplied. First and only argument is token for enterprise bundles." + echo "No argument supplied. First argument is token for enterprise bundles." exit; fi +SEARCH_ENGINE=${2:-openSearch} +CONFIG_FILE_PATH=".github/ci/files/config/packages/test/config.yaml" +if [ -z "$2" ]; then + echo "Second argument was not supplied. Using OpenSearch for tests by default." +fi + docker compose down -v --remove-orphans docker compose up -d -docker compose exec php .github/ci/scripts/setup-pimcore-environment-functional-tests.sh +docker compose exec php .github/ci/scripts/setup-pimcore-environment-functional-tests.sh "$SEARCH_ENGINE" docker compose exec php composer config --global --auth http-basic.repo.pimcore.com token $1 @@ -18,6 +24,22 @@ docker compose exec php composer config --global --auth http-basic.repo.pimcore. docker compose exec php composer update #docker compose exec php composer update --prefer-lowest --prefer-stable +# Wait for Elasticsearch to be ready +step=5 # Check every 5 seconds +elapsed=0 + +if [ "$SEARCH_ENGINE" == "elasticsearch" ]; then + echo "Waiting for Elasticsearch to be up..." + until docker compose exec php curl -u elastic:somethingsecret -s http://elastic:9200/_cluster/health | grep -q '"status":"green"'; do + echo "... ($elapsed seconds elapsed)" + elapsed=$((elapsed + step)) + sleep $step + done + echo "Elasticsearch is up and ready." +else + echo "Using OpenSearch for testing..." +fi + docker compose exec php vendor/bin/codecept run Functional -vv printf "\n\n\n================== \n"