From 1f7f51e35922f03840b9cf7ceb7a48e851ea64fb Mon Sep 17 00:00:00 2001 From: Derek Stephen McLean Date: Tue, 6 Feb 2024 15:08:52 +0100 Subject: [PATCH 1/2] [SearchBundle, NodeSearchBundle] : change `nGram` to `ngram` --- .../NodeSearchBundle/Configuration/NodePagesConfiguration.php | 2 +- src/Kunstmaan/SearchBundle/Search/AbstractAnalysisFactory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php b/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php index f28b8cc3f6..f6a2df61ff 100644 --- a/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php +++ b/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php @@ -327,7 +327,7 @@ public function setAnalysis(Index $index, AnalysisFactoryInterface $analysis) $ngramDiff = 1; if (isset($analysers['tokenizer']) && count($analysers['tokenizer']) > 0) { foreach ($analysers['tokenizer'] as $tokenizer) { - if ($tokenizer['type'] === 'nGram') { + if ($tokenizer['type'] === 'ngram') { $diff = $tokenizer['max_gram'] - $tokenizer['min_gram']; $ngramDiff = $diff > $ngramDiff ? $diff : $ngramDiff; diff --git a/src/Kunstmaan/SearchBundle/Search/AbstractAnalysisFactory.php b/src/Kunstmaan/SearchBundle/Search/AbstractAnalysisFactory.php index c0c6377826..8fa7cd261f 100644 --- a/src/Kunstmaan/SearchBundle/Search/AbstractAnalysisFactory.php +++ b/src/Kunstmaan/SearchBundle/Search/AbstractAnalysisFactory.php @@ -98,7 +98,7 @@ public function addStripSpecialCharsFilter() public function addNGramTokenizer() { $this->tokenizers['kuma_ngram'] = [ - 'type' => 'nGram', + 'type' => 'ngram', 'min_gram' => 4, 'max_gram' => 30, 'token_chars' => ['letter', 'digit', 'punctuation'], From 211616a3c91ea55ea0320713dc45a39ae94f72d8 Mon Sep 17 00:00:00 2001 From: Derek Stephen McLean Date: Thu, 8 Feb 2024 13:12:11 +0100 Subject: [PATCH 2/2] strtolower $tokenizer['type'] #3331 --- .../NodeSearchBundle/Configuration/NodePagesConfiguration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php b/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php index f6a2df61ff..6548fa853d 100644 --- a/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php +++ b/src/Kunstmaan/NodeSearchBundle/Configuration/NodePagesConfiguration.php @@ -327,7 +327,7 @@ public function setAnalysis(Index $index, AnalysisFactoryInterface $analysis) $ngramDiff = 1; if (isset($analysers['tokenizer']) && count($analysers['tokenizer']) > 0) { foreach ($analysers['tokenizer'] as $tokenizer) { - if ($tokenizer['type'] === 'ngram') { + if (\strtolower($tokenizer['type']) === 'ngram') { $diff = $tokenizer['max_gram'] - $tokenizer['min_gram']; $ngramDiff = $diff > $ngramDiff ? $diff : $ngramDiff;