Class: Spotlight::SolrController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spotlight/solr_controller.rb

Instance Method Summary collapse

Methods included from Controller

#blacklight_config, #current_exhibit, #current_masthead, #current_masthead=, #default_masthead?, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_url, #search_action_url, #search_facet_url

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#updateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spotlight/solr_controller.rb', line 5

def update
  authorize! :update_solr, @exhibit

  req = ActiveSupport::JSON.decode(request.body.read)

  docs = Array.wrap(req).map do |r|
    SolrDocument.new(r).to_solr.merge(@exhibit.solr_data).merge(r)
  end

  blacklight_solr.update docs

  render nothing: true
end