From c9cb281413247ae7a32470be7a30d407c23f9b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarina=20Mio=C4=8Di=C4=87?= Date: Thu, 9 May 2024 14:01:43 +0200 Subject: [PATCH] NGSTACK-843 solr FieldMapper fix --- lib/Container/Compiler/PageIndexingPass.php | 2 +- .../ContentTranslation/ContentPageTextFieldMapper.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Container/Compiler/PageIndexingPass.php b/lib/Container/Compiler/PageIndexingPass.php index 8c4af343..00fd8798 100644 --- a/lib/Container/Compiler/PageIndexingPass.php +++ b/lib/Container/Compiler/PageIndexingPass.php @@ -26,7 +26,7 @@ public function process(ContainerBuilder $container) ->register(ContentPageTextFieldMapper::class, ContentPageTextFieldMapper::class) ->setArguments([ new Reference('netgen.ibexa_search_extra.page_indexing.page_text_extractor'), - '%netgen_ibexa_search_extra.page_indexing.sites%', + new Reference('netgen.ibexa_search_extra.page_indexing.site_access_resolver'), ]) ->addTag('ibexa.search.solr.field.mapper.content.translation'); } diff --git a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ContentPageTextFieldMapper.php b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ContentPageTextFieldMapper.php index df3f1d6c..5dfab87c 100644 --- a/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ContentPageTextFieldMapper.php +++ b/lib/Core/Search/Solr/FieldMapper/ContentTranslation/ContentPageTextFieldMapper.php @@ -7,12 +7,13 @@ use Ibexa\Contracts\Core\Search\FieldType\FullTextField; use Ibexa\Contracts\Solr\FieldMapper\ContentTranslationFieldMapper; use Netgen\IbexaSearchExtra\Core\Search\Common\PageTextExtractor; +use Netgen\IbexaSearchExtra\Core\Search\Common\SiteAccessConfigResolver; class ContentPageTextFieldMapper extends ContentTranslationFieldMapper { public function __construct( private readonly PageTextExtractor $pageTextExtractor, - private readonly array $allowedContentTypes, + private readonly SiteAccessConfigResolver $siteAccessConfigResolver ) {} public function accept(Content $content, $languageCode): bool { @@ -22,8 +23,9 @@ public function accept(Content $content, $languageCode): bool public function mapFields(Content $content, $languageCode): array { $contentTypeIdentifier = $content->versionInfo->contentInfo->contentTypeId; + $allowedContentTypes = $this->siteAccessConfigResolver->getSiteConfigForContent($content->versionInfo->contentInfo->id); - if (!in_array($contentTypeIdentifier, $this->allowedContentTypes, true)) { + if (!in_array($contentTypeIdentifier, $allowedContentTypes, true)) { return []; }