From 6b0e825746e8cd1e5dd64289fd8a716c15b47156 Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 5 Apr 2023 20:54:11 -0700 Subject: [PATCH] Always print candidates --- raiju.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/raiju.go b/raiju.go index 3097735..9ca8114 100644 --- a/raiju.go +++ b/raiju.go @@ -247,12 +247,11 @@ func (r Raiju) Candidates(ctx context.Context, request CandidatesRequest) ([]Rel sort.Sort(sort.Reverse(sortDistance(allCandidates))) - if int64(len(allCandidates)) < request.Limit { - return allCandidates, nil + candidates := allCandidates + if int64(len(allCandidates)) >= request.Limit { + candidates = allCandidates[:request.Limit] } - candidates := allCandidates[:request.Limit] - printNodes(candidates) return candidates, nil