Skip to content

Commit

Permalink
MemberSearchBuilder does not need collection from the scope
Browse files Browse the repository at this point in the history
The collection id is already passed to the search builder as parameters.
This loosens the coupling between the search builder and the controller.
  • Loading branch information
jcoyne committed Sep 7, 2016
1 parent 79b5397 commit 10a6dcd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/search_builders/curation_concerns/member_search_builder.rb
Expand Up @@ -6,12 +6,16 @@ class MemberSearchBuilder < ::SearchBuilder
# Defines which search_params_logic should be used when searching for Collection members
self.default_processor_chain += [:include_collection_ids]

delegate :collection, to: :scope

# include filters into the query to only include the collection memebers
def include_collection_ids(solr_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] << "{!join from=#{from_field} to=id}id:#{collection.id}"
solr_parameters[:fq] << "{!join from=#{from_field} to=id}id:#{collection_id}"
end

protected

def collection_id
blacklight_params.fetch('id')
end
end
end

0 comments on commit 10a6dcd

Please sign in to comment.