Fix query by segment

* Changed topN queries to use joda Interval instead of string values
* topN by segment now implements `BySegmentResultValue<Result<TopNResultValue>>` instead of `BySegmentResultValue<TopNResultValue>`
* Added a unit test which failed under the prior implementation.
* Fixes #845 
I don't expect this to be a problem, but just to be sure, can we check that a broker without the patch can de-serialize results from a historical node with the patch? This is to ensure we can do rolling upgrades.