Skip to content

Commit

Permalink
include states. datacite/datacite#359
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Nov 22, 2019
1 parent 42c683b commit 0ca02f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions app/controllers/concerns/facetable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ def providers_totals(arr)
{ "id" => hsh["key"],
"title" => providers[hsh["key"].upcase],
"count" => hsh["doc_count"],
"year" => facet_annual(hsh.year.buckets)
"year" => facet_annual(hsh.year.buckets),
"states" => facet_by_key(hsh.states.buckets)

# "this_month" => facet_anual(hsh.this_month.buckets),
# "this_year" => facet_anual(hsh.this_year.buckets),
Expand All @@ -339,7 +340,9 @@ def prefixes_totals(arr)
{ "id" => hsh["key"],
"title" => hsh["key"],
"count" => hsh["doc_count"],
"year" => facet_annual(hsh.year.buckets)
"year" => facet_annual(hsh.year.buckets),
"states" => facet_by_key(hsh.states.buckets)

# "temporal" => {
# "this_month" => facet_anual(hsh.this_month.buckets),
# "this_year" => facet_anual(hsh.this_year.buckets),
Expand All @@ -360,7 +363,9 @@ def clients_totals(arr)
{ "id" => hsh["key"],
"title" => clients[hsh["key"].upcase],
"count" => hsh["doc_count"],
"year" => facet_annual(hsh.year.buckets)
"year" => facet_annual(hsh.year.buckets),
"states" => facet_by_key(hsh.states.buckets)

# "temporal" => {
# "this_month" => facet_anual(hsh.this_month.buckets),
# "this_year" => facet_anual(hsh.this_year.buckets),
Expand Down
5 changes: 4 additions & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,10 @@ def self.totals_aggregations
end

def self.sub_aggregations
{ year: { date_histogram: { field: "created", interval: "year", format: "yyyy" } } }
{
states: { terms: { field: 'aasm_state', size: 4, min_doc_count: 1 } },
year: { date_histogram: { field: "created", interval: "year", format: "yyyy" } }
}

# {
# states: { terms: { field: 'aasm_state', size: 4, min_doc_count: 1 } },
Expand Down

0 comments on commit 0ca02f5

Please sign in to comment.