all repos — searchix @ b1fd7104004b9646f541afbc0add3047dbff59a7

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

fix: nil panics rendering last page of search results
Alan Pearce alan@alanpearce.eu
Sat, 13 Jul 2024 17:03:08 +0200
commit

b1fd7104004b9646f541afbc0add3047dbff59a7

parent

ee83dfd741c47bd25eac1ac7139f20875de0452c

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

jump to
M internal/index/search.gointernal/index/search.go
@@ -109,7 +109,7 @@ if err != nil { 			return nil, errors.WithMessage(err, "failed to execute search query")
 		}
 
-		results := make([]DocumentMatch, min(ResultsPerPage, bleveResult.Total))
+		results := make([]DocumentMatch, bleveResult.Hits.Len())
 		var buf bytes.Buffer
 		for i, result := range bleveResult.Hits {
 			results[i].DocumentMatch = bleveResult.Hits[i]