Skip to content

Commit

Permalink
added facet for subjects for blog
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Jan 14, 2019
1 parent 60114f4 commit 7b93b2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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] = {
Expand Down
3 changes: 2 additions & 1 deletion app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7b93b2d

Please sign in to comment.