diff options
author | Alan Pearce | 2024-05-09 19:12:52 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-09 19:28:15 +0200 |
commit | c72f8dc787379f6544739c5c57a8241a14f6d2a0 (patch) | |
tree | e3ef963dd526206b68fb3d1125bb0b7e6c0bcd51 /internal | |
parent | 3b379a13710cae2adc56131af1069e6fb92976b8 (diff) | |
download | searchix-c72f8dc787379f6544739c5c57a8241a14f6d2a0.tar.lz searchix-c72f8dc787379f6544739c5c57a8241a14f6d2a0.tar.zst searchix-c72f8dc787379f6544739c5c57a8241a14f6d2a0.zip |
style: rename Option.Option to Option.Name
Diffstat (limited to 'internal')
-rw-r--r-- | internal/importer/ingest.go | 2 | ||||
-rw-r--r-- | internal/options/option.go | 2 | ||||
-rw-r--r-- | internal/search/indexer.go | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/internal/importer/ingest.go b/internal/importer/ingest.go index b9db80c..3d6854d 100644 --- a/internal/importer/ingest.go +++ b/internal/importer/ingest.go @@ -220,7 +220,7 @@ func (i *OptionIngester) Process(ctx context.Context) (<-chan *options.NixOption // slog.Debug("sending option", "name", kv.Key) results <- &options.NixOption{ - Option: kv.Key, + Name: kv.Key, Source: strings.ToLower(i.source.Name), Declarations: decs, Default: convertNixValue(i.optJSON.Default), diff --git a/internal/options/option.go b/internal/options/option.go index b7fe818..a93b4e2 100644 --- a/internal/options/option.go +++ b/internal/options/option.go @@ -13,7 +13,7 @@ type Link struct { } type NixOption struct { - Option string + Name string Source string Declarations []Link diff --git a/internal/search/indexer.go b/internal/search/indexer.go index ad891ff..0ff041f 100644 --- a/internal/search/indexer.go +++ b/internal/search/indexer.go @@ -122,7 +122,7 @@ func NewIndexer(indexPath string, force bool) (*WriteIndex, error) { optionMapping := bleve.NewDocumentStaticMapping() - optionMapping.AddFieldMappingsAt("Option", keywordFieldMapping) + optionMapping.AddFieldMappingsAt("Name", keywordFieldMapping) optionMapping.AddFieldMappingsAt("Source", keywordFieldMapping) optionMapping.AddFieldMappingsAt("Loc", locFieldMapping) optionMapping.AddFieldMappingsAt("RelatedPackages", textFieldMapping) @@ -165,10 +165,10 @@ func (i *WriteIndex) ImportOptions( default: } - doc := document.NewDocument(opt.Source + "/" + opt.Option) + doc := document.NewDocument(opt.Source + "/" + opt.Name) err = i.indexMapping.MapDocument(doc, opt) if err != nil { - errs <- errors.WithMessagef(err, "could not map document for option: %s", opt.Option) + errs <- errors.WithMessagef(err, "could not map document for option: %s", opt.Name) continue } @@ -184,11 +184,11 @@ func (i *WriteIndex) ImportOptions( field := document.NewTextFieldWithIndexingOptions("_data", nil, data.Bytes(), index.StoreField) newDoc := doc.AddField(field) - // slog.Debug("adding option to index", "name", opt.Option) + // slog.Debug("adding option to index", "name", opt.Name) err = batch.IndexAdvanced(newDoc) if err != nil { - errs <- errors.WithMessagef(err, "could not index option %s", opt.Option) + errs <- errors.WithMessagef(err, "could not index option %s", opt.Name) continue } |