Class: Triannon::SearchController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Triannon::SearchController
- Includes:
- RdfResponseFormats
- Defined in:
- app/controllers/triannon/search_controller.rb
Instance Method Summary collapse
Methods included from RdfResponseFormats
#context_url_from_accept, #context_url_from_link, #default_format_jsonld, #mime_type_from_accept
Methods inherited from ApplicationController
#access_token_data, #access_token_error, #access_token_expired?, #access_token_generate, #access_token_valid?, #json_response, #json_type_accepted
Instance Method Details
#find ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/triannon/search_controller.rb', line 10 def find anno_graphs_array = solr_searcher.find(params) # add id to iiif_anno_list @list_hash = Triannon::IIIFAnnoList.anno_list(anno_graphs_array) @list_hash["@id"] = request.original_url if @list_hash respond_to do |format| format.jsonld { render :json => @list_hash.to_json, content_type: "application/ld+json" } format.ttl { accept_return_type = mime_type_from_accept(["application/x-turtle", "text/turtle"]) render :body => RDF::Graph.new.from_jsonld(@list_hash.to_json).to_ttl, content_type: accept_return_type if accept_return_type } format.rdfxml { accept_return_type = mime_type_from_accept(["application/rdf+xml", "text/rdf+xml", "text/rdf"]) render :body => RDF::Graph.new.from_jsonld(@list_hash.to_json).to_rdfxml, content_type: accept_return_type if accept_return_type } format.json { accept_return_type = mime_type_from_accept(["application/json", "text/x-json", "application/jsonrequest"]) render :json => @list_hash.to_json, content_type: accept_return_type } format.xml { accept_return_type = mime_type_from_accept(["application/xml", "text/xml", "application/x-xml"]) render :xml => RDF::Graph.new.from_jsonld(@list_hash.to_json).to_rdfxml, content_type: accept_return_type if accept_return_type } format.html { render :find } end end |