Skip to content

Commit

Permalink
include member_types facet. datacite/datacite#725
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 24, 2019
1 parent c8a56a6 commit 6a04f9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def index
total_pages = page[:size] > 0 ? (total.to_f / page[:size]).ceil : 0
years = total > 0 ? facet_by_year(response.response.aggregations.years.buckets) : nil
regions = total > 0 ? facet_by_region(response.response.aggregations.regions.buckets) : nil
member_types = total > 0 ? facet_by_key(response.response.aggregations.member_types.buckets) : nil
organization_types = total > 0 ? facet_by_key(response.response.aggregations.organization_types.buckets) : nil
focus_areas = total > 0 ? facet_by_key(response.response.aggregations.focus_areas.buckets) : nil

Expand All @@ -46,6 +47,7 @@ def index
page: page[:number],
years: years,
regions: regions,
"memberTypes" => member_types,
"organizationTypes" => organization_types,
"focusAreas" => focus_areas
}.compact
Expand All @@ -56,6 +58,7 @@ def index
query: params[:query],
year: params[:year],
region: params[:region],
"member_type" => params[:member_type],
"organization_type" => params[:organization_type],
"focus-area" => params[:focus_area],
fields: params[:fields],
Expand Down
1 change: 1 addition & 0 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def self.query_aggregations
years: { date_histogram: { field: 'created', interval: 'year', min_doc_count: 1 } },
cumulative_years: { terms: { field: 'cumulative_years', min_doc_count: 1, order: { _count: "asc" } } },
regions: { terms: { field: 'region', size: 10, min_doc_count: 1 } },
member_types: { terms: { field: 'member_type', size: 10, min_doc_count: 1 } },
organization_types: { terms: { field: 'organization_type', size: 10, min_doc_count: 1 } },
focus_areas: { terms: { field: 'focus_area', size: 10, min_doc_count: 1 } }
}
Expand Down

0 comments on commit 6a04f9a

Please sign in to comment.