diff options
author | Alan Pearce | 2024-05-17 14:05:31 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-17 14:05:31 +0200 |
commit | 42611df8133fc88bac5947a65a18fa095d68a951 (patch) | |
tree | 5c582bbec78b6838891fcec216f4dcd92bf45f99 /internal/index | |
parent | 29f2099e68a3226060308c66e5b1aa19fb2ba8e0 (diff) | |
download | searchix-42611df8133fc88bac5947a65a18fa095d68a951.tar.lz searchix-42611df8133fc88bac5947a65a18fa095d68a951.tar.zst searchix-42611df8133fc88bac5947a65a18fa095d68a951.zip |
feat(index): enable storage of package data
Diffstat (limited to 'internal/index')
-rw-r--r-- | internal/index/indexer.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/index/indexer.go b/internal/index/indexer.go index da2fab3..a661b61 100644 --- a/internal/index/indexer.go +++ b/internal/index/indexer.go @@ -101,7 +101,17 @@ func createIndexMapping() (mapping.IndexMapping, error) { optionMapping.AddSubDocumentMapping("Default", nixValueMapping) optionMapping.AddSubDocumentMapping("Example", nixValueMapping) + packageMapping := bleve.NewDocumentStaticMapping() + + packageMapping.AddFieldMappingsAt("Name", keywordFieldMapping) + packageMapping.AddFieldMappingsAt("Source", keywordFieldMapping) + packageMapping.AddFieldMappingsAt("Description", textFieldMapping) + packageMapping.AddFieldMappingsAt("MainProgram", keywordFieldMapping) + packageMapping.AddFieldMappingsAt("PackageSet", keywordFieldMapping) + packageMapping.AddFieldMappingsAt("Platforms", keywordFieldMapping) + indexMapping.AddDocumentMapping("option", optionMapping) + indexMapping.AddDocumentMapping("package", packageMapping) return indexMapping, nil } @@ -259,7 +269,7 @@ func (i *WriteIndex) Import( var data bytes.Buffer enc := gob.NewEncoder(&data) - err = enc.Encode(obj) + err = enc.Encode(&obj) if err != nil { errs <- errors.WithMessage(err, "could not store object in search index") |