Class: Hyrax::NestedCollectionsParentSearchBuilder
- Inherits:
-
SearchBuilder
- Object
- SearchBuilder
- Hyrax::NestedCollectionsParentSearchBuilder
- Includes:
- FilterByType
- Defined in:
- app/search_builders/hyrax/nested_collections_parent_search_builder.rb
Overview
Searches for all collections that are parents of a given collection.
Instance Attribute Summary collapse
-
#child ⇒ Object
readonly
Returns the value of attribute child.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(scope:, child:, page:) ⇒ NestedCollectionsParentSearchBuilder
constructor
A new instance of NestedCollectionsParentSearchBuilder.
-
#parent_collections_only(solr_parameters) ⇒ Object
Filters the query to only include the parent collections.
- #with_pagination(solr_parameters) ⇒ Object
Methods included from FilterByType
Constructor Details
#initialize(scope:, child:, page:) ⇒ NestedCollectionsParentSearchBuilder
Returns a new instance of NestedCollectionsParentSearchBuilder.
9 10 11 12 13 |
# File 'app/search_builders/hyrax/nested_collections_parent_search_builder.rb', line 9 def initialize(scope:, child:, page:) @child = child @page = page super(scope) end |
Instance Attribute Details
#child ⇒ Object (readonly)
Returns the value of attribute child.
5 6 7 |
# File 'app/search_builders/hyrax/nested_collections_parent_search_builder.rb', line 5 def child @child end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
5 6 7 |
# File 'app/search_builders/hyrax/nested_collections_parent_search_builder.rb', line 5 def limit @limit end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
5 6 7 |
# File 'app/search_builders/hyrax/nested_collections_parent_search_builder.rb', line 5 def page @page end |
Instance Method Details
#parent_collections_only(solr_parameters) ⇒ Object
Filters the query to only include the parent collections
16 17 18 19 |
# File 'app/search_builders/hyrax/nested_collections_parent_search_builder.rb', line 16 def parent_collections_only(solr_parameters) solr_parameters[:fq] ||= [] solr_parameters[:fq] << ActiveFedora::SolrQueryBuilder.construct_query_for_ids(child.member_of_collection_ids) end |
#with_pagination(solr_parameters) ⇒ Object
22 23 24 |
# File 'app/search_builders/hyrax/nested_collections_parent_search_builder.rb', line 22 def with_pagination(solr_parameters) solr_parameters[:page] = page end |