Class: Hyrax::Dashboard::NestedCollectionsSearchBuilder
- Inherits:
-
CollectionSearchBuilder
- Object
- SearchBuilder
- CollectionSearchBuilder
- Hyrax::Dashboard::NestedCollectionsSearchBuilder
- Defined in:
- app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb
Overview
Responsible for searching for collections of the same type that are not the given collection
Instance Attribute Summary collapse
-
#discovery_permissions ⇒ Object
readonly
Override for Hydra::AccessControlsEnforcement.
Attributes inherited from CollectionSearchBuilder
Instance Method Summary collapse
-
#gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability) ⇒ Array<String>
If :deposit access is requested, check to see which collections the user has deposit or manage access to.
-
#initialize(access:, collection:, scope:, nesting_attributes:, nest_direction:) ⇒ NestedCollectionsSearchBuilder
constructor
A new instance of NestedCollectionsSearchBuilder.
- #show_only_other_collections_of_the_same_collection_type(solr_parameters) ⇒ Object
- #with_pagination(solr_parameters) ⇒ Object
Methods inherited from CollectionSearchBuilder
#add_sorting_to_solr, #models, #sort_field, #with_access
Methods included from FilterByType
Constructor Details
#initialize(access:, collection:, scope:, nesting_attributes:, nest_direction:) ⇒ NestedCollectionsSearchBuilder
Returns a new instance of NestedCollectionsSearchBuilder.
10 11 12 13 14 15 16 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 10 def initialize(access:, collection:, scope:, nesting_attributes:, nest_direction:) super(scope) @collection = collection @discovery_permissions = (access) @nesting_attributes = nesting_attributes @nest_direction = nest_direction end |
Instance Attribute Details
#discovery_permissions ⇒ Object (readonly)
Override for Hydra::AccessControlsEnforcement
19 20 21 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 19 def @discovery_permissions end |
Instance Method Details
#gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability) ⇒ Array<String>
If :deposit access is requested, check to see which collections the user has deposit or manage access to.
38 39 40 41 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 38 def gated_discovery_filters( = , ability = current_ability) return super unless .include?("deposit") ["{!terms f=id}#{collection_ids_for_deposit.join(',')}"] end |
#show_only_other_collections_of_the_same_collection_type(solr_parameters) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 26 def show_only_other_collections_of_the_same_collection_type(solr_parameters) solr_parameters[:fq] ||= [] solr_parameters[:fq] += [ "-" + ActiveFedora::SolrQueryBuilder.construct_query_for_ids(limit_ids), ActiveFedora::SolrQueryBuilder.construct_query(Collection.collection_type_gid_document_field_name => @collection.collection_type_gid) ] solr_parameters[:fq] += limit_clause if limit_clause # add limits to prevent illegal nesting arrangements end |
#with_pagination(solr_parameters) ⇒ Object
22 23 24 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 22 def with_pagination(solr_parameters) solr_parameters[:rows] = 1000 end |