about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-05-17 22:59:57 +0200
committerAlan Pearce2024-05-17 22:59:57 +0200
commit698881aa577d2c209f162db9263fab17ced3643f (patch)
treebb7a3abeb44e6283ce96fe8708a7e273869cecf1
parentf10543d0aff0e203dd57287dc2b736c686e69102 (diff)
downloadsearchix-698881aa577d2c209f162db9263fab17ced3643f.tar.lz
searchix-698881aa577d2c209f162db9263fab17ced3643f.tar.zst
searchix-698881aa577d2c209f162db9263fab17ced3643f.zip
feat: use attribute instead of name for packages
-rw-r--r--frontend/templates/blocks/packages.gotmpl4
-rw-r--r--internal/importer/package.go1
-rw-r--r--internal/index/indexer.go2
-rw-r--r--internal/nix/package.go1
4 files changed, 5 insertions, 3 deletions
diff --git a/frontend/templates/blocks/packages.gotmpl b/frontend/templates/blocks/packages.gotmpl
index 472b86e..b6e4584 100644
--- a/frontend/templates/blocks/packages.gotmpl
+++ b/frontend/templates/blocks/packages.gotmpl
@@ -5,9 +5,9 @@
         <summary>
           <h3>
             {{- if .Broken }}
-              <del>{{ .Name }}</del>
+              <del>{{ .Attribute }}</del>
             {{- else }}
-              {{ .Name }}
+              {{ .Attribute }}
             {{- end }}
           </h3>
         </summary>
diff --git a/internal/importer/package.go b/internal/importer/package.go
index 3905016..b3d2bac 100644
--- a/internal/importer/package.go
+++ b/internal/importer/package.go
@@ -228,6 +228,7 @@ func (i *PackageIngester) Process(parent context.Context) (<-chan nix.Importable
 
 			results <- &nix.Package{
 				Name:            i.pkg.Name,
+				Attribute:       kv.Key,
 				Source:          i.source.Key,
 				PackageSet:      pkgSet,
 				Version:         i.pkg.Version,
diff --git a/internal/index/indexer.go b/internal/index/indexer.go
index 4a6a9d8..3a146c3 100644
--- a/internal/index/indexer.go
+++ b/internal/index/indexer.go
@@ -104,7 +104,7 @@ func createIndexMapping() (mapping.IndexMapping, error) {
 
 	packageMapping := bleve.NewDocumentStaticMapping()
 
-	packageMapping.AddFieldMappingsAt("Name", keywordFieldMapping)
+	packageMapping.AddFieldMappingsAt("Attribute", keywordFieldMapping)
 	packageMapping.AddFieldMappingsAt("Source", keywordFieldMapping)
 	packageMapping.AddFieldMappingsAt("Description", textFieldMapping)
 	packageMapping.AddFieldMappingsAt("MainProgram", keywordFieldMapping)
diff --git a/internal/nix/package.go b/internal/nix/package.go
index ddfee09..813b2f0 100644
--- a/internal/nix/package.go
+++ b/internal/nix/package.go
@@ -2,6 +2,7 @@ package nix
 
 type Package struct {
 	Name            string
+	Attribute       string
 	Source          string
 	Broken          bool
 	Definition      string