From df5db969262db1382dcd9310d362efdf8f8b6949 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 Dec 2024 19:04:56 +0100 Subject: feat: de-rank packages on 'all' search Implements: https://todo.sr.ht/~alanpearce/searchix/4 --- internal/index/search.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/index/search.go b/internal/index/search.go index 9063f20..a3c05da 100644 --- a/internal/index/search.go +++ b/internal/index/search.go @@ -148,6 +148,12 @@ func (index *ReadIndex) Search( 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 -- cgit 1.4.1