From 3be3c1f4c5a3da8b4b853cbf49491661ca78ca90 Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Tue, 23 Sep 2014 16:57:20 +0000 Subject: [PATCH] added default granulatrity to time fragments' --- core/http.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/http.go b/core/http.go index 6e237e12b..b1f30e081 100644 --- a/core/http.go +++ b/core/http.go @@ -346,13 +346,24 @@ func bitmaps(frame string, obj JsonObject) chan uint64 { if timestamp == "2014-01-01 00:00:00" { //skip the default timestamp c <- base_id } else { + quantum := index.YMDH + if val, ok := obj["time_granulatrity"]; ok { + switch val { + case "Y": + quantum = index.Y + case "M": + quantum = index.YM + case "D": + quantum = index.YMD + } + } shortForm := shortFormS if strings.Contains(timestamp, "T") { shortForm = shortFormT } atime, _ := time.Parse(shortForm, timestamp) - for _, id := range index.GetTimeIds(base_id, atime, index.YMDH) { + for _, id := range index.GetTimeIds(base_id, atime, quantum) { c <- id } }