diff options
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 } |