diff options
author | Alan Pearce | 2024-11-20 11:14:49 +0100 |
---|---|---|
committer | Alan Pearce | 2024-11-20 11:14:49 +0100 |
commit | 72d56a6781e97cde13ba068e8553e9342bd1fa20 (patch) | |
tree | 0f3d9d6f32873507d6e4edba94603d4817a981ae /internal/index/indexer.go | |
parent | 7cbe90e090634f48086f6c64bb976a2c962bb2d2 (diff) | |
download | searchix-72d56a6781e97cde13ba068e8553e9342bd1fa20.tar.lz searchix-72d56a6781e97cde13ba068e8553e9342bd1fa20.tar.zst searchix-72d56a6781e97cde13ba068e8553e9342bd1fa20.zip |
feat: apply stemming to search index terms
Diffstat (limited to 'internal/index/indexer.go')
-rw-r--r-- | internal/index/indexer.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/index/indexer.go b/internal/index/indexer.go index 47701bd..476ca29 100644 --- a/internal/index/indexer.go +++ b/internal/index/indexer.go @@ -20,6 +20,7 @@ import ( "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" "github.com/blevesearch/bleve/v2/analysis/analyzer/web" "github.com/blevesearch/bleve/v2/analysis/token/camelcase" + "github.com/blevesearch/bleve/v2/analysis/token/porter" "github.com/blevesearch/bleve/v2/analysis/tokenizer/letter" "github.com/blevesearch/bleve/v2/analysis/tokenizer/single" "github.com/blevesearch/bleve/v2/document" @@ -61,6 +62,7 @@ func createIndexMapping() (mapping.IndexMapping, error) { "tokenizer": letter.Name, "token_filters": []string{ camelcase.Name, + porter.Name, }, }) if err != nil { @@ -71,6 +73,7 @@ func createIndexMapping() (mapping.IndexMapping, error) { "tokenizer": letter.Name, "token_filters": []string{ camelcase.Name, + porter.Name, }, }) if err != nil { @@ -79,6 +82,9 @@ func createIndexMapping() (mapping.IndexMapping, error) { err = indexMapping.AddCustomAnalyzer("keyword_single", map[string]interface{}{ "type": keyword.Name, "tokenizer": single.Name, + "token_filters": []string{ + porter.Name, + }, }) if err != nil { return nil, errors.WithMessage(err, "could not add custom analyser") |