fix: ngram min_gram=1 indexes tokens that can never be matched

Flarum's search UI enforces a minimum query length of 3 characters
(MIN_SEARCH_LEN in Search.tsx), so 1- and 2-character ngram tokens
are indexed but can never be queried. Changed min_gram from 1 to 3
and updated max_ngram_diff accordingly.
This commit is contained in:
Bart van Bragt 2026-04-09 08:43:15 +02:00
parent 369ee504f3
commit 6699c8cb58
1 changed files with 2 additions and 2 deletions

View File

@ -87,7 +87,7 @@ class BuildCommand extends Command
'index' => $index,
'body' => [
'settings' => [
'index.max_ngram_diff' => 10,
'index.max_ngram_diff' => 7,
'analysis' => [
'analyzer' => [
'flarum_analyzer' => [
@ -105,7 +105,7 @@ class BuildCommand extends Command
'filter' => [
'partial_search_filter' => [
'type' => 'ngram',
'min_gram' => 1,
'min_gram' => 3,
'max_gram' => 10,
'token_chars' => ['letter', 'digit', 'symbol'],
],