Skip to content

Commit

Permalink
Merge pull request #5821 from avalonmediasystem/content_search_service
Browse files Browse the repository at this point in the history
Add search service to IIIF manifest
  • Loading branch information
masaball authored May 8, 2024
2 parents 330f37f + 11145e1 commit 1a6a04e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ GIT

GIT
remote: https://github.com/samvera/iiif_manifest.git
revision: 1ea71a9cae92f498b80e98006b9fa8cefe21d3b9
revision: 75a3702d58982b37bb9ce327dcd6686273a6ccbb
branch: main
specs:
iiif_manifest (1.5.0)
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/master_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ def transcript
send_data @supplemental_file.file.download, filename: @supplemental_file.file.filename.to_s, type: @supplemental_file.file.content_type, disposition: 'inline'
end

def search
# TODO: Build search service
end

protected
def set_masterfile
if params[:id].blank? || (not MasterFile.exists?(params[:id]))
Expand Down
9 changes: 9 additions & 0 deletions app/models/iiif_canvas_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ def placeholder_content
end
end

def service
[
{
"@id" => "#{Rails.application.routes.url_helpers.search_master_file_url(master_file.id)}",
"type" => "SearchService2"
}
]
end

private

def video_content
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
delete 'structure', to: 'master_files#delete_structure', constraints: { format: 'json' }
post 'move'
get 'transcript/:t_id', to: 'master_files#transcript'
get :search
end

# Supplemental Files
Expand Down
9 changes: 9 additions & 0 deletions spec/models/iiif_canvas_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,13 @@
expect(subject.any? { |sa| sa["@id"] =~ /supplemental_files\/#{caption_file.id}/ }).to eq false
end
end

describe '#service' do
subject { presenter.service }

it 'includes the content search service' do
expect(subject.any? { |content| content['@id'] =~ /master_files\/#{master_file.id}\/search/ }).to eq true
expect(subject.first["type"]).to eq 'SearchService2'
end
end
end

0 comments on commit 1a6a04e

Please sign in to comment.