Class: Hyrax::SearchState

Inherits:
Blacklight::SearchState
  • Object
show all
Defined in:
lib/hyrax/search_state.rb

Instance Method Summary collapse

Instance Method Details

#to_hashObject Also known as: to_h

The SPARQL gem stomps on the Rails definition of deep_dup and gives us a Hash instead of a HashWithIndifferentAccess. This is an ugly workaround to get the right contract with the upstream class. github.com/ruby-rdf/sparql/blob/develop/lib/sparql/algebra/extensions.rb#L238-L244



17
18
19
# File 'lib/hyrax/search_state.rb', line 17

def to_hash
  super.with_indifferent_access
end

#url_for_document(doc, _options = {}) ⇒ Object

Override Blacklight so we can use the per-worktype routes

Parameters:

  • doc (#collection?, #model_name)


8
9
10
11
# File 'lib/hyrax/search_state.rb', line 8

def url_for_document(doc, _options = {})
  return [hyrax, doc] if doc.collection?
  [main_app, doc]
end