about summary refs log tree commit diff stats
path: root/internal/index/indexer.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-29 11:56:51 +0200
committerAlan Pearce2024-05-29 11:56:51 +0200
commit73185e4633d4f56ce8acdd3cc19f78faaa78bd2b (patch)
treea50878b5592a8ed165db9faff07c103620a682fc /internal/index/indexer.go
parent838e178e503d9576a40fce8fc986c4e1972e4c0f (diff)
downloadsearchix-73185e4633d4f56ce8acdd3cc19f78faaa78bd2b.tar.lz
searchix-73185e4633d4f56ce8acdd3cc19f78faaa78bd2b.tar.zst
searchix-73185e4633d4f56ce8acdd3cc19f78faaa78bd2b.zip
feat: improve search relevance by boosting keyword matches
Diffstat (limited to 'internal/index/indexer.go')
-rw-r--r--internal/index/indexer.go3
1 files changed, 2 insertions, 1 deletions
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)