From c09cc669da0aac264f0bc44bddc3634e26f8c1c9 Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Fri, 9 Feb 2024 11:15:27 +0100 Subject: [PATCH 1/2] pass locale to lucene index in multi search context --- UPGRADE.md | 3 +++ src/OutputChannel/MultiSearchOutputChannel.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index c539d04..8b43530 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,8 @@ # Upgrade Notes +## 3.0.2 +- [BUGFIX] Pass locale to lucene index in multi search context + ## 3.0.1 - Fix ZendSearch Version Constraint diff --git a/src/OutputChannel/MultiSearchOutputChannel.php b/src/OutputChannel/MultiSearchOutputChannel.php index 2dac0cc..8cb0db2 100644 --- a/src/OutputChannel/MultiSearchOutputChannel.php +++ b/src/OutputChannel/MultiSearchOutputChannel.php @@ -61,6 +61,7 @@ public function getResult(SearchContainerInterface $searchContainer): SearchCont public function getMultiSearchResult(MultiSearchContainerInterface $multiSearchContainer): MultiSearchContainerInterface { + $userLocale = $this->outputChannelContext->getRuntimeQueryProvider()->getUserLocale(); $indexProviderOptions = $this->outputChannelContext->getIndexProviderOptions(); foreach ($multiSearchContainer->getSearchContainer() as $searchContainer) { @@ -68,7 +69,7 @@ public function getMultiSearchResult(MultiSearchContainerInterface $multiSearchC $query = $searchContainer->getQuery(); $eventData = $this->eventDispatcher->dispatchAction('build_index', [ - 'index' => $this->storageBuilder->getLuceneIndex($indexProviderOptions, ConfigurationInterface::INDEX_BASE_STABLE) + 'index' => $this->storageBuilder->getLuceneIndex($indexProviderOptions, ConfigurationInterface::INDEX_BASE_STABLE, $userLocale) ]); /** @var Lucene\SearchIndexInterface $index */ From 36035cd8cddb8c0c82b76d0a046b7b419a5829f9 Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Fri, 9 Feb 2024 11:20:51 +0100 Subject: [PATCH 2/2] remove comparison --- src/Factory/AnalyzerFactory.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Factory/AnalyzerFactory.php b/src/Factory/AnalyzerFactory.php index 75634c5..9dbac03 100644 --- a/src/Factory/AnalyzerFactory.php +++ b/src/Factory/AnalyzerFactory.php @@ -106,10 +106,6 @@ public function buildDefaultFilter(?string $currentLocale, array $filterOptions) $isLocaleAware = isset($filterOptions['locale_aware']) && is_bool($filterOptions['locale_aware']) && $filterOptions['locale_aware']; $filterClass = $filterOptions['class'] ?? SnowBallStemmingFilter::class; - if ($filterClass === null) { - return null; - } - if ($isLocaleAware === true && $currentLocale === null) { return null; }