diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb index 969e3572e..7b5c55a8d 100644 --- a/app/controllers/providers_controller.rb +++ b/app/controllers/providers_controller.rb @@ -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 @@ -46,6 +47,7 @@ def index page: page[:number], years: years, regions: regions, + "memberTypes" => member_types, "organizationTypes" => organization_types, "focusAreas" => focus_areas }.compact @@ -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], diff --git a/app/models/provider.rb b/app/models/provider.rb index 99e61aff8..5cad5edc2 100644 --- a/app/models/provider.rb +++ b/app/models/provider.rb @@ -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 } } }