diff options
author | Alan Pearce | 2024-12-30 19:04:56 +0100 |
---|---|---|
committer | Alan Pearce | 2024-12-30 19:07:42 +0100 |
commit | df5db969262db1382dcd9310d362efdf8f8b6949 (patch) | |
tree | ad3b9c220f06775dd8a27e6ebc540386cbabbd8d | |
parent | 7b5fc09fce4a41c2899a7157843b5d3106749b8b (diff) | |
download | searchix-df5db969262db1382dcd9310d362efdf8f8b6949.tar.lz searchix-df5db969262db1382dcd9310d362efdf8f8b6949.tar.zst searchix-df5db969262db1382dcd9310d362efdf8f8b6949.zip |
feat: de-rank packages on 'all' search
Implements: https://todo.sr.ht/~alanpearce/searchix/4
-rw-r--r-- | internal/index/search.go | 6 |
1 files changed, 6 insertions, 0 deletions
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 |