Class: CurationConcerns::CollectionSearchBuilder

Inherits:
SearchBuilder
  • Object
show all
Includes:
FilterByType
Defined in:
app/search_builders/curation_concerns/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, CurationConcerns::SearchFilters

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FilterByType

#filter_models

Constructor Details

#initializeCollectionSearchBuilder

Defines which search_params_logic should be used when searching for Collections



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

def initialize(*)
  @rows = 100
  super
end

Instance Attribute Details

#discovery_perms=(value) ⇒ Object (writeonly)

TODO: remove this line



28
29
30
# File 'app/search_builders/curation_concerns/collection_search_builder.rb', line 28

def discovery_perms=(value)
  @discovery_perms = value
end

Instance Method Details

#access_levelsHash{Symbol => Array[Symbol]}

Note:

i.e., requiring :read access is satisfied by either :read or :edit access

Returns bottom-up map of “what you need” to “what qualifies”.

Returns:

  • (Hash{Symbol => Array[Symbol]})

    bottom-up map of “what you need” to “what qualifies”



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

def access_levels
  { read: [:read, :edit], edit: [:edit] }
end

#add_sorting_to_solr(solr_parameters) ⇒ Object

Sort results by title if no query was supplied. This overrides the default ‘relevance’ sort.



48
49
50
51
# File 'app/search_builders/curation_concerns/collection_search_builder.rb', line 48

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

#discovery_permissionsObject

unprotect lib/blacklight/access_controls/enforcement.rb methods Remove these when github.com/projectblacklight/blacklight-access_controls/pull/23 is merged/released/required



33
34
35
# File 'app/search_builders/curation_concerns/collection_search_builder.rb', line 33

def discovery_permissions
  @discovery_perms || super
end

#discovery_permissions=(*args) ⇒ Object



37
38
39
# File 'app/search_builders/curation_concerns/collection_search_builder.rb', line 37

def discovery_permissions=(*args)
  super
end

#modelsObject

This overrides the models in FilterByType



42
43
44
# File 'app/search_builders/curation_concerns/collection_search_builder.rb', line 42

def models
  collection_classes
end

#sort_fieldString

Returns Solr field name indicating default sort order.

Returns:

  • (String)

    Solr field name indicating default sort order



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

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