style: rename Option.Option to Option.Name
Alan Pearce alan@alanpearce.eu
Thu, 09 May 2024 19:12:52 +0200
4 files changed, 9 insertions(+), 9 deletions(-)
M frontend/templates/blocks/options.gotmpl → frontend/templates/blocks/options.gotmpl
@@ -4,9 +4,9 @@ {{- if gt .Results.Total 0 }} <section id="results"> {{- range .Results.Hits }} {{- with .Data }} - <details id="{{ .Option }}"> + <details id="{{ .Name }}"> <summary> - {{ .Option }} + {{ .Name }} </summary> <p> {{ markdown .Description }}
M internal/importer/ingest.go → internal/importer/ingest.go
@@ -220,7 +220,7 @@ } // 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),
M internal/options/option.go → internal/options/option.go
@@ -13,7 +13,7 @@ URL string } type NixOption struct { - Option string + Name string Source string Declarations []Link
M internal/search/indexer.go → internal/search/indexer.go
@@ -122,7 +122,7 @@ locFieldMapping.Store = false 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 @@ break outer 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 @@ } 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 }