From 5557f529a75c47d6310f8a082ab6133895793415 Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Thu, 25 Sep 2014 13:58:56 +0000 Subject: [PATCH] off by one bug in all --- index/brand.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index/brand.go b/index/brand.go index 0a488904d..94658d3c7 100644 --- a/index/brand.go +++ b/index/brand.go @@ -224,7 +224,7 @@ func dump(r RankList, n int) { func (self *Brand) TopNAll(n int, categories []uint64) []Pair { self.checkRank() - results := make([]Pair, n) + results := make([]Pair, n+1) category := NewIntSet() needCat := false @@ -241,7 +241,7 @@ func (self *Brand) TopNAll(n int, categories []uint64) []Pair { } } - if count > n { + if count >= n { break } results[count] = Pair{pair.Key, pair.Count}