Skip to content

Commit

Permalink
filter by member_type. 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 6a04f9a commit 5fea883
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def index
elsif params[:ids].present?
response = Provider.find_by_id(params[:ids], page: page, sort: sort)
else
response = Provider.query(params[:query], year: params[:year], region: params[:region], organization_type: params[:organization_type], focus_area: params[:focus_area], page: page, sort: sort)
response = Provider.query(params[:query], year: params[:year], region: params[:region], member_type: params[:member_type], organization_type: params[:organization_type], focus_area: params[:focus_area], page: page, sort: sort)
end

begin
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ def query(query, options={})
if self.name == "Provider"
must << { range: { created: { gte: "#{options[:year].split(",").min}||/y", lte: "#{options[:year].split(",").max}||/y", format: "yyyy" }}} if options[:year].present?
must << { term: { region: options[:region].upcase }} if options[:region].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: { focus_area: options[:focus_area] }} if options[:focus_area].present?
must << { terms: { role_name: %w( ROLE_FOR_PROFIT_PROVIDER ROLE_CONTRACTUAL_PROVIDER ROLE_CONSORTIUM_LEAD ROLE_ALLOCATOR ROLE_MEMBER) }}

must_not << { exists: { field: "deleted_at" }} unless options[:include_deleted]
elsif self.name == "Client"
Expand Down

0 comments on commit 5fea883

Please sign in to comment.