diff options
author | Alan Pearce | 2024-05-17 17:02:00 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-17 17:02:00 +0200 |
commit | 3b877b39b424ded0f776d1dc71d07616a47bfbd4 (patch) | |
tree | ae438cc9b532c622689d7dec013d5a5264aec74c /internal/importer/package.go | |
parent | 041ebd2291db60e73d7fc213cd8a74d33b7f089b (diff) | |
download | searchix-3b877b39b424ded0f776d1dc71d07616a47bfbd4.tar.lz searchix-3b877b39b424ded0f776d1dc71d07616a47bfbd4.tar.zst searchix-3b877b39b424ded0f776d1dc71d07616a47bfbd4.zip |
fix: store only data from current entity in index
Diffstat (limited to 'internal/importer/package.go')
-rw-r--r-- | internal/importer/package.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/importer/package.go b/internal/importer/package.go index 4e006cb..3905016 100644 --- a/internal/importer/package.go +++ b/internal/importer/package.go @@ -39,7 +39,7 @@ type maintainerJSON struct { type PackageIngester struct { dec *jstream.Decoder ms *mapstructure.Decoder - pkg *packageJSON + pkg packageJSON infile io.ReadCloser source *config.Source } @@ -62,14 +62,14 @@ func makeAdhocPlatform(v any) string { func NewPackageProcessor(infile io.ReadCloser, source *config.Source) (*PackageIngester, error) { i := &PackageIngester{ dec: jstream.NewDecoder(infile, 2).EmitKV(), - pkg: &packageJSON{}, + pkg: packageJSON{}, infile: infile, source: source, } ms, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ ZeroFields: true, - Result: i.pkg, + Result: &i.pkg, Squash: true, DecodeHook: mapstructure.TextUnmarshallerHookFunc(), }) @@ -203,6 +203,7 @@ func (i *PackageIngester) Process(parent context.Context) (<-chan nix.Importable } } + i.pkg = packageJSON{} err = i.ms.Decode(x) // stores in i.pkg if err != nil { errs <- errors.WithMessagef(err, "failed to decode package %#v", x) |