Class: Hyrax::CollectionSearchBuilder

Inherits:
SearchBuilder
  • Object
show all
Includes:
FilterByType
Defined in:
app/search_builders/hyrax/collection_search_builder.rb

Overview

Note:

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

Direct Known Subclasses

ParentCollectionSearchBuilder

Instance Method Summary collapse

Methods included from FilterByType

#filter_models

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.



24
25
26
27
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 24

def add_sorting_to_solr(solr_parameters)
  return if solr_parameters[:q]
  solr_parameters[:sort] ||= "#{sort_field} asc"
end

#modelsObject

This overrides the models in FilterByType



18
19
20
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 18

def models
  collection_classes
end

#sort_fieldString

Returns Solr field name indicating default sort order.

Returns:

  • (String)

    Solr field name indicating default sort order



13
14
15
# File 'app/search_builders/hyrax/collection_search_builder.rb', line 13

def sort_field
  Solrizer.solr_name('title', :sortable)
end