Class: Workarea::Reports::SearchesWithoutResultsOverTime
- Inherits:
-
Object
- Object
- Workarea::Reports::SearchesWithoutResultsOverTime
show all
- Includes:
- GroupByTime, Report
- Defined in:
- app/queries/workarea/reports/searches_without_results_over_time.rb
Instance Method Summary
collapse
#group_by, #time_group_id
Methods included from Report
#cache_key, #count, #ends_at, #initialize, #limit, #more_results?, #results, #slug, #sort, #sort_by, #sort_direction, #sort_value, #starts_at
Instance Method Details
#aggregation ⇒ Object
10
11
12
|
# File 'app/queries/workarea/reports/searches_without_results_over_time.rb', line 10
def aggregation
[filter, project_used_fields, group_by_time]
end
|
#filter ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'app/queries/workarea/reports/searches_without_results_over_time.rb', line 14
def filter
{
'$match' => {
'reporting_on' => { '$gte' => starts_at.utc, '$lte' => ends_at.utc },
'total_results' => 0
}
}
end
|
#group_by_time ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'app/queries/workarea/reports/searches_without_results_over_time.rb', line 27
def group_by_time
{
'$group' => {
'_id' => time_group_id,
'starts_at' => { '$min' => '$reporting_on' },
'searches' => { '$sum' => '$searches' }
}
}
end
|
#project_used_fields ⇒ Object
23
24
25
|
# File 'app/queries/workarea/reports/searches_without_results_over_time.rb', line 23
def project_used_fields
{ '$project' => { 'reporting_on' => 1, 'searches' => 1 } }
end
|