From 73185e4633d4f56ce8acdd3cc19f78faaa78bd2b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 29 May 2024 11:56:51 +0200 Subject: feat: improve search relevance by boosting keyword matches --- internal/index/indexer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'internal/index/indexer.go') diff --git a/internal/index/indexer.go b/internal/index/indexer.go index 742cf5e..a59889a 100644 --- a/internal/index/indexer.go +++ b/internal/index/indexer.go @@ -101,7 +101,7 @@ func createIndexMapping() (mapping.IndexMapping, error) { optionMapping := bleve.NewDocumentStaticMapping() - optionMapping.AddFieldMappingsAt("Name", keywordFieldMapping) + optionMapping.AddFieldMappingsAt("Name", nameMapping) optionMapping.AddFieldMappingsAt("Source", keywordFieldMapping) optionMapping.AddFieldMappingsAt("Loc", locFieldMapping) optionMapping.AddFieldMappingsAt("RelatedPackages", textFieldMapping) @@ -112,6 +112,7 @@ func createIndexMapping() (mapping.IndexMapping, error) { packageMapping := bleve.NewDocumentStaticMapping() + packageMapping.AddFieldMappingsAt("Name", nameMapping) packageMapping.AddFieldMappingsAt("Attribute", keywordFieldMapping) packageMapping.AddFieldMappingsAt("Source", keywordFieldMapping) packageMapping.AddFieldMappingsAt("Description", textFieldMapping) -- cgit 1.4.1