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
Dashboard::CollectionsSearchBuilder, Dashboard::NestedCollectionsSearchBuilder, ParentCollectionSearchBuilder
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.
13 14 15 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 13 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.
37 38 39 40 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 37 def add_sorting_to_solr(solr_parameters) return if solr_parameters[:q] solr_parameters[:sort] ||= "#{sort_field} asc" end |
#discovery_permissions ⇒ Object
Overrides Hydra::AccessControlsEnforcement
16 17 18 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 16 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.
45 46 47 48 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 45 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
26 27 28 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 26 def models collection_classes end |
#sort_field ⇒ String
Returns Solr field name indicating default sort order.
21 22 23 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 21 def sort_field Solrizer.solr_name('title', :sortable) end |
#with_access(access) ⇒ Object
30 31 32 33 |
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 30 def with_access(access) @access = access super(access) end |