Sha256: 7e2c6c0bf9ff6c2b29053b9f9a3317cfde21a48334009cf2e11bf9a2b6707197

Contents?: true

Size: 726 Bytes

Versions: 22

Compression:

Stored size: 726 Bytes

Contents

module Spotlight
  ##
  # Proxy update requests to Solr and inject spotlight's exhibit
  # specific fields.
  #
  # This is an example of how you could integrate external indexing
  # workflows with exhibit-specific content
  class SolrController < Spotlight::ApplicationController
    before_action :authenticate_user!
    load_and_authorize_resource :exhibit, class: Spotlight::Exhibit

    def update
      authorize! :update_solr, @exhibit

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

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

      blacklight_solr.update docs

      render nothing: true
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-spotlight-0.14.2 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.14.1 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.14.0 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.13.0 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.12.1 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.12.0 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.11.0 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.10.3 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.10.2 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.10.1 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.10.0 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.9.2 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.9.1 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.9.0 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.8.2 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.8.1 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.8.0 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.7.2 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.7.1 app/controllers/spotlight/solr_controller.rb
blacklight-spotlight-0.7.0 app/controllers/spotlight/solr_controller.rb