Class: Hyrax::CollectionSearchBuilder
- Inherits:
-
SearchBuilder
- Object
- SearchBuilder
- Hyrax::CollectionSearchBuilder
- Includes:
- FilterByType
- Defined in:
- app/search_builders/hyrax/collection_search_builder.rb
Overview
the default_processor_chain defined by Blacklight::Solr::SearchBuilderBehavior provides many possible points of override
Our parent class is the generated SearchBuilder descending from Blacklight::SearchBuilder It includes Blacklight::Solr::SearchBuilderBehavior, Hydra::AccessControlsEnforcement, Hyrax::SearchFilters Allows :deposit as a valid type
Direct Known Subclasses
CollectionMemberSearchBuilder, Dashboard::CollectionsSearchBuilder, Dashboard::NestedCollectionsSearchBuilder, My::CollectionsSearchBuilder, NestedCollectionsParentSearchBuilder, ParentCollectionSearchBuilder, SingleCollectionSearchBuilder
Instance Attribute Summary collapse
-
#access ⇒ Object
readonly
Returns the value of attribute access.
Instance Method Summary collapse
-
#add_sorting_to_solr(solr_parameters) ⇒ Object
Sort results by title if no query was supplied.
-
#discovery_permissions ⇒ Object
Overrides Hydra::AccessControlsEnforcement.
-
#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.
-
#models ⇒ Object
This overrides the models in FilterByType.
-
#sort_field ⇒ String
Solr field name indicating default sort order.
- #with_access(access) ⇒ Object
Methods included from FilterByType
Instance Attribute Details
#access ⇒ Object (readonly)
Returns the value of attribute access.
14 15 16 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 14 def access @access end |
Instance Method Details
#add_sorting_to_solr(solr_parameters) ⇒ Object
Sort results by title if no query was supplied. This overrides the default ‘relevance’ sort.
38 39 40 41 42 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 38 def add_sorting_to_solr(solr_parameters) return if solr_parameters[:q] solr_parameters[:sort] ||= sort solr_parameters[:sort] ||= "#{sort_field} asc" end |
#discovery_permissions ⇒ Object
Overrides Hydra::AccessControlsEnforcement
17 18 19 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 17 def @discovery_permissions = (@access) end |
#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.
47 48 49 50 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 47 def gated_discovery_filters( = , ability = current_ability) return super unless .include?("deposit") ["{!terms f=id}#{collection_ids_for_deposit.join(',')}"] end |
#models ⇒ Object
This overrides the models in FilterByType
27 28 29 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 27 def models collection_classes end |
#sort_field ⇒ String
Returns Solr field name indicating default sort order.
22 23 24 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 22 def sort_field "title_si" end |
#with_access(access) ⇒ Object
31 32 33 34 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 31 def with_access(access) @access = access super(access) end |