Avoid returning topk items with zero bytes

This commit is contained in:
emanuele-f 2018-09-24 16:09:23 +02:00
parent b8aa23f46d
commit b604288c9b

View file

@ -564,10 +564,12 @@ function driver:topk(schema, tags, tstart, tend, options, top_tags)
local topk = {}
for top_item, value in pairsByValues(items, rev) do
topk[#topk + 1] = {
tags = tag_2_series[top_item],
value = value,
}
if value > 0 then
topk[#topk + 1] = {
tags = tag_2_series[top_item],
value = value,
}
end
if #topk >= options.top then
break