From 6275b7b124ab33e50fd73f6652bad689e61c08ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Fri, 19 May 2023 16:13:30 +0200 Subject: [PATCH] Do not include full-text and tag data in the composite field This commit removes the full-text and tag data from the composite field ("_all") which can be used for default term queries which we don't do anyways. --- services/search/pkg/engine/bleve.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/search/pkg/engine/bleve.go b/services/search/pkg/engine/bleve.go index 7347bbec177..e330f7bb087 100644 --- a/services/search/pkg/engine/bleve.go +++ b/services/search/pkg/engine/bleve.go @@ -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)