fix: don't error when item not found
Alan Pearce alan@alanpearce.eu
Sat, 17 Aug 2024 14:43:42 +0200
2 files changed, 4 insertions(+), 1 deletions(-)
M .golangci.yaml → .golangci.yaml
@@ -10,7 +10,6 @@ - gosec - grouper - lll - nilerr - - nilnil - nlreturn - noctx - nosprintfhostport
M internal/index/search.go → internal/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 }