diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb index 11cf5fe61..283654650 100644 --- a/app/controllers/providers_controller.rb +++ b/app/controllers/providers_controller.rb @@ -34,6 +34,7 @@ def index member_type: params[:member_type], organization_type: params[:organization_type], focus_area: params[:focus_area], + non_profit_status: params[:non_profit_status], page: page, sort: sort) end @@ -46,6 +47,7 @@ def index 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 + non_profit_statuses = total > 0 ? facet_by_key(response.response.aggregations.non_profit_statuses.buckets) : nil @providers = response.results respond_to do |format| @@ -59,7 +61,8 @@ def index regions: regions, "memberTypes" => member_types, "organizationTypes" => organization_types, - "focusAreas" => focus_areas + "focusAreas" => focus_areas, + "nonProfitStatuses" => non_profit_statuses }.compact options[:links] = { @@ -71,6 +74,7 @@ def index "member_type" => params[:member_type], "organization_type" => params[:organization_type], "focus-area" => params[:focus_area], + "non-profit-status" => params[:non_profit_status], "page[number]" => page[:number] + 1, "page[size]" => page[:size], sort: sort }.compact.to_query diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index acb840bb0..b43f60b31 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -180,6 +180,7 @@ def query(query, options={}) must << { term: { "consortium_id.raw" => options[:consortium_id] }} if options[:consortium_id].present? must << { term: { member_type: options[:member_type] }} if options[:member_type].present? must << { term: { organization_type: options[:organization_type] }} if options[:organization_type].present? + must << { term: { non_profit_status: options[:non_profit_status] }} if options[:non_profit_status].present? must << { term: { focus_area: options[:focus_area] }} if options[:focus_area].present? must_not << { exists: { field: "deleted_at" }} unless options[:include_deleted] diff --git a/app/models/provider.rb b/app/models/provider.rb index f1d8f939a..ad6603de1 100644 --- a/app/models/provider.rb +++ b/app/models/provider.rb @@ -236,7 +236,8 @@ def self.query_aggregations 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 } } + focus_areas: { terms: { field: 'focus_area', size: 10, min_doc_count: 1 } }, + non_profit_statuses: { terms: { field: 'non_profit_status', size: 10, min_doc_count: 1 } } } end