Sha256: c83333df5d625bf90621f7f3fca352b8a13ac804609bc887130eb93f050ab549
Contents?: true
Size: 828 Bytes
Versions: 13
Compression:
Stored size: 828 Bytes
Contents
module Workarea module Reports class SearchesOverTime include Report include GroupByTime self.reporting_class = Metrics::SearchByDay self.sort_fields = %w(_id searches) def aggregation [filter_date_range, project_used_fields, group_by_time] end def filter_date_range { '$match' => { 'reporting_on' => { '$gte' => starts_at, '$lte' => ends_at } } } end def project_used_fields { '$project' => { 'reporting_on' => 1, 'searches' => 1 } } end def group_by_time { '$group' => { '_id' => time_group_id, 'starts_at' => { '$min' => '$reporting_on' }, 'searches' => { '$sum' => '$searches' } } } end end end end
Version data entries
13 entries across 13 versions & 1 rubygems