all repos — searchix @ df5db969262db1382dcd9310d362efdf8f8b6949

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: de-rank packages on 'all' search

Implements: https://todo.sr.ht/~alanpearce/searchix/4
Alan Pearce alan@alanpearce.eu
Mon, 30 Dec 2024 19:04:56 +0100
commit

df5db969262db1382dcd9310d362efdf8f8b6949

parent

7b5fc09fce4a41c2899a7157843b5d3106749b8b

1 files changed, 6 insertions(+), 0 deletions(-)

jump to
M internal/index/search.gointernal/index/search.go
@@ -148,6 +148,12 @@ if source != nil { 		query.AddMust(
 			setField(bleve.NewTermQuery(source.Key), "Source"),
 		)
+	} else {
+		q := bleve.NewTermQuery("nixpkgs")
+		q.SetField("Source")
+		q.SetBoost(-100)
+
+		query.AddShould(q)
 	}
 
 	// ...and boost it if it matches any of these