Skip to content

Commit

Permalink
Merge pull request #6356 from aduffeck/reduce-search-index-size
Browse files Browse the repository at this point in the history
Do not include full-text and tag data in the composite field
  • Loading branch information
aduffeck authored May 22, 2023
2 parents 6b87cfd + 6275b7b commit 798f3d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion services/search/pkg/engine/bleve.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ func NewBleveEngine(index bleve.Index) *Bleve {

// BuildBleveMapping builds a bleve index mapping which can be used for indexing
func BuildBleveMapping() (mapping.IndexMapping, error) {
nameMapping := bleve.NewTextFieldMapping()
nameMapping.Analyzer = "lowercaseKeyword"

lowercaseMapping := bleve.NewTextFieldMapping()
lowercaseMapping.IncludeInAll = false
lowercaseMapping.Analyzer = "lowercaseKeyword"

fulltextFieldMapping := bleve.NewTextFieldMapping()
fulltextFieldMapping.Analyzer = "fulltext"
fulltextFieldMapping.IncludeInAll = false

docMapping := bleve.NewDocumentMapping()
docMapping.AddFieldMappingsAt("Name", lowercaseMapping)
docMapping.AddFieldMappingsAt("Name", nameMapping)
docMapping.AddFieldMappingsAt("Tags", lowercaseMapping)
docMapping.AddFieldMappingsAt("Content", fulltextFieldMapping)

Expand Down

0 comments on commit 798f3d5

Please sign in to comment.