all repos — searchix @ b427c2657582caa9b2cce8bcfd82624663dda780

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

fix: don't error when item not found
Alan Pearce alan@alanpearce.eu
Sat, 17 Aug 2024 14:43:42 +0200
commit

b427c2657582caa9b2cce8bcfd82624663dda780

parent

7ce45a76aebde0249a78e044ae9d416f86473038

2 files changed, 4 insertions(+), 1 deletions(-)

jump to
M .golangci.yaml.golangci.yaml
@@ -10,7 +10,6 @@ - gosec         - grouper
         - lll
         - nilerr
-        - nilnil
         - nlreturn
         - noctx
         - nosprintfhostport
M internal/index/search.gointernal/index/search.go
@@ -189,5 +189,9 @@ if err != nil { 		return nil, err
 	}
 
+	if result.Total == 0 {
+		return nil, nil
+	}
+
 	return &result.Hits[0].Data, err
 }