about summary refs log tree commit diff stats
path: root/internal/index
diff options
context:
space:
mode:
authorAlan Pearce2024-07-13 17:03:08 +0200
committerAlan Pearce2024-07-13 17:03:08 +0200
commitb1fd7104004b9646f541afbc0add3047dbff59a7 (patch)
tree2604f03f314d659144b510764f276f251bbd9dd0 /internal/index
parentee83dfd741c47bd25eac1ac7139f20875de0452c (diff)
downloadsearchix-b1fd7104004b9646f541afbc0add3047dbff59a7.tar.lz
searchix-b1fd7104004b9646f541afbc0add3047dbff59a7.tar.zst
searchix-b1fd7104004b9646f541afbc0add3047dbff59a7.zip
fix: nil panics rendering last page of search results
Diffstat (limited to 'internal/index')
-rw-r--r--internal/index/search.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/index/search.go b/internal/index/search.go
index c5b8c6b..e7cec4c 100644
--- a/internal/index/search.go
+++ b/internal/index/search.go
@@ -109,7 +109,7 @@ func (index *ReadIndex) search(
 			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]