Skip to content

Commit

Permalink
query and agg to find datacite-crossref events with wrong subj
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Feb 13, 2020
1 parent 85bb924 commit e42b388
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def index
year_month: params[:year_month],
aggregations: params[:aggregations],
unique: params[:unique],
state_event: params[:state],
scroll_id: params[:scroll_id],
page: page,
sort: sort)
Expand Down Expand Up @@ -156,6 +157,8 @@ def index
downloads_histogram = nil
unique_obj_count = nil
unique_subj_count = nil
states = nil


bm = Benchmark.ms {
aggregations = params.fetch(:aggregations, "") || ""
Expand All @@ -181,6 +184,8 @@ def index
# downloads = total.positive? ? EventsQuery.new.downloads(params[:doi]) : nil
unique_obj_count = total.positive? && aggregations.include?("advanced_aggregations") ? response.response.aggregations.unique_obj_count.value : nil
unique_subj_count = total.positive? && aggregations.include?("advanced_aggregations") ? response.response.aggregations.unique_subj_count.value : nil
states = total.positive? && aggregations.include?("state_aggregations") ? facet_by_source(response.response.aggregations.states.buckets) : nil

}
Rails.logger.warn method: "GET", path: "/events", message: "Aggregations /events", duration: bm

Expand All @@ -204,6 +209,7 @@ def index
"uniqueCitations": citations,
"references": references,
"relations": relations,
"states": states,
"uniqueNodes": {
"objCount": unique_obj_count,
"subjCount": unique_subj_count
Expand Down

0 comments on commit e42b388

Please sign in to comment.