From 19ff229ddbb57aa1918d7aa12313a3a6527850fe Mon Sep 17 00:00:00 2001 From: Vidar Langseid Date: Tue, 9 Jul 2024 15:54:32 +0200 Subject: [PATCH 1/2] IBX-8378: Fixed handling non-indexable field types For more details see https://issues.ibexa.co/browse/IBX-8378 and https://github.com/ezsystems/ezplatform-solr-search-engine/pull/250 Key changes: * Skipped mapping non-searchable fields * Aligned PHPStan baseline with the latest release --- ignore-lte-php7.4-errors.neon | 2 +- .../BlockDocumentsContentFields.php | 2 +- .../ContentDocumentFulltextFields.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ignore-lte-php7.4-errors.neon b/ignore-lte-php7.4-errors.neon index 22e0ed62..c0a225bb 100644 --- a/ignore-lte-php7.4-errors.neon +++ b/ignore-lte-php7.4-errors.neon @@ -1,6 +1,6 @@ parameters: ignoreErrors: - - message: "#^Anonymous function should return array but returns array\\\\|false\\.$#" + message: "#^Anonymous function should return array\\ but returns array\\\\|false\\.$#" count: 1 path: tests/lib/Search/ResultExtractor/AggregationResultExtractor/TermAggregationResultExtractorTest.php diff --git a/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php b/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php index cc6edab7..de960d50 100644 --- a/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php +++ b/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php @@ -74,7 +74,7 @@ public function mapFields(Content $content, $languageCode) } foreach ($contentType->fieldDefinitions as $fieldDefinition) { - if ($fieldDefinition->id !== $field->fieldDefinitionId) { + if ($fieldDefinition->id !== $field->fieldDefinitionId || !$fieldDefinition->isSearchable) { continue; } diff --git a/lib/FieldMapper/ContentTranslationFieldMapper/ContentDocumentFulltextFields.php b/lib/FieldMapper/ContentTranslationFieldMapper/ContentDocumentFulltextFields.php index 6e63753c..ddf4e452 100644 --- a/lib/FieldMapper/ContentTranslationFieldMapper/ContentDocumentFulltextFields.php +++ b/lib/FieldMapper/ContentTranslationFieldMapper/ContentDocumentFulltextFields.php @@ -128,7 +128,7 @@ private function doMapFields(Content $content, ContentType $contentType, $langua } foreach ($contentType->fieldDefinitions as $fieldDefinition) { - if ($fieldDefinition->id !== $field->fieldDefinitionId) { + if ($fieldDefinition->id !== $field->fieldDefinitionId || !$fieldDefinition->isSearchable) { continue; } @@ -140,7 +140,7 @@ private function doMapFields(Content $content, ContentType $contentType, $langua continue; } - if (!$indexField->type instanceof FieldType\FullTextField || !$fieldDefinition->isSearchable) { + if (!$indexField->type instanceof FieldType\FullTextField) { continue; } From c2333a06c97602d8e5dffacd70b20c8665cd88b4 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Tue, 9 Jul 2024 16:07:25 +0200 Subject: [PATCH 2/2] [PHPStan] Aligned baseline with the changes --- phpstan-baseline.neon | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 83371b29..2993acd5 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -330,36 +330,11 @@ parameters: count: 1 path: src/lib/FieldMapper/ContentTranslationFieldMapper/Aggregate.php - - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Search\\\\Field\\:\\:\\$name\\.$#" - count: 1 - path: src/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php - - - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Search\\\\Field\\:\\:\\$type\\.$#" - count: 2 - path: src/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php - - - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Search\\\\Field\\:\\:\\$value\\.$#" - count: 2 - path: src/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Search\\\\FieldType\\:\\:\\$boost \\(int\\) does not accept float\\.$#" count: 1 path: src/lib/FieldMapper/ContentTranslationFieldMapper/BlockDocumentsContentFields.php - - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Search\\\\Field\\:\\:\\$type\\.$#" - count: 1 - path: src/lib/FieldMapper/ContentTranslationFieldMapper/ContentDocumentFulltextFields.php - - - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Search\\\\Field\\:\\:\\$value\\.$#" - count: 2 - path: src/lib/FieldMapper/ContentTranslationFieldMapper/ContentDocumentFulltextFields.php - - message: "#^Parameter \\#2 \\$array of function array_map expects array, iterable\\ given\\.$#" count: 1