Module: BlacklightIiifSearch::Controller

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/blacklight_iiif_search/controller.rb

Instance Method Summary collapse

Instance Method Details

#iiif_searchObject



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/concerns/blacklight_iiif_search/controller.rb', line 13

def iiif_search
  @parent_document = search_service.fetch(params[:solr_document_id])
  iiif_search = IiifSearch.new(iiif_search_params, iiif_search_config, @parent_document)
  iiif_search_service = search_service_class.new(config: blacklight_config,
                                                 user_params: iiif_search.solr_params)
  @response = iiif_search_service.search_results
  iiif_search_response = IiifSearchResponse.new(@response, @parent_document, self)

  render json: iiif_search_response.annotation_list, content_type: 'application/json'
end

#iiif_search_configObject



29
30
31
# File 'app/controllers/concerns/blacklight_iiif_search/controller.rb', line 29

def iiif_search_config
  blacklight_config.iiif_search || {}
end

#iiif_search_paramsObject



33
34
35
# File 'app/controllers/concerns/blacklight_iiif_search/controller.rb', line 33

def iiif_search_params
  params.permit(:q, :motivation, :date, :user, :solr_document_id, :page)
end

#iiif_suggestObject



24
25
26
27
# File 'app/controllers/concerns/blacklight_iiif_search/controller.rb', line 24

def iiif_suggest
  suggest_search = IiifSuggestSearch.new(params, Blacklight.default_index, self)
  render json: suggest_search.response, content_type: 'application/json'
end