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 
@xvrl : good call, I'll check.