diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 66dfb0745..1127759c9 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -174,6 +174,8 @@ def index link_checks_dc_identifier = total > 0 ? response.response.aggregations.link_checks_dc_identifier.value : nil link_checks_citation_doi = total > 0 ? response.response.aggregations.link_checks_citation_doi.value : nil links_checked = total > 0 ? response.response.aggregations.links_checked.value : nil + subjects = total > 0 ? facet_by_key(response.response.aggregations.subjects.buckets) : nil + respond_to do |format| format.json do @@ -197,7 +199,8 @@ def index "linksWithSchemaOrg" => links_with_schema_org, "linkChecksSchemaOrgId" => link_checks_schema_org_id, "linkChecksDcIdentifier" => link_checks_dc_identifier, - "linkChecksCitationDoi" => link_checks_citation_doi + "linkChecksCitationDoi" => link_checks_citation_doi, + subjects: subjects }.compact options[:links] = { diff --git a/app/models/doi.rb b/app/models/doi.rb index 03b1761ea..a9012ce50 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -324,7 +324,8 @@ def self.query_aggregations sources: { terms: { field: 'source', size: 15, min_doc_count: 1 } }, this_month: { date_range: { field: 'created', time_zone: "CET", ranges: {from: beginning_of_month, to: "now/d"} } }, this_year: { date_range: { field: 'created', time_zone: "CET", ranges: {from: beginning_of_year, to: "now/d"} } }, - last_year: { date_range: { field: 'created', time_zone: "CET", ranges: {from: beginning_of_last_year, to: beginning_of_year} } } + last_year: { date_range: { field: 'created', time_zone: "CET", ranges: {from: beginning_of_last_year, to: beginning_of_year} } }, + subjects: { terms: { field: 'subjects.subject', size: 15, min_doc_count: 1 } } } end