-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from scientist-softserv/move-solr-document-de…
…corator-out-of-engine Move solr document decorator out of engine
- Loading branch information
Showing
13 changed files
with
87 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
module IiifPrint | ||
module SolrDocumentDecorator | ||
def digest_sha1 | ||
digest[/urn:sha1:([\w]+)/, 1] | ||
end | ||
|
||
def method_missing(method_name, *args, &block) | ||
super unless iiif_print_solr_field_names.include? method_name.to_s | ||
self[IiifPrint.solr_name(method_name.to_s)] | ||
end | ||
|
||
def respond_to_missing?(method_name, include_private = false) | ||
iiif_print_solr_field_names.include?(method_name.to_s) || super | ||
end | ||
|
||
# @see https://github.com/samvera/hyrax/commit/7108409c619cd2ba4ae8c836b9f3b429a7e9837b | ||
def file_set_ids | ||
# Yes, this looks a little odd. But the truth is the prior key (e.g. `file_set_ids_ssim`) was | ||
# an alias of `member_ids_ssim`. | ||
self['member_ids_ssim'] | ||
end | ||
|
||
def any_highlighting? | ||
response&.[]('highlighting')&.[](id)&.present? | ||
end | ||
|
||
def solr_document | ||
self | ||
end | ||
end | ||
end | ||
|
||
SolrDocument.prepend(IiifPrint::SolrDocumentDecorator) | ||
SolrDocument.attribute :is_child, Hyrax::SolrDocument::Metadata::Solr::String, 'is_child_bsi' | ||
SolrDocument.attribute :split_from_pdf_id, Hyrax::SolrDocument::Metadata::Solr::String, 'split_from_pdf_id_ssi' | ||
SolrDocument.attribute :digest, Hyrax::SolrDocument::Metadata::Solr::String, 'digest_ssim' | ||
|
||
# @note These properties came from the newspaper_works gem. They are configurable. | ||
SolrDocument.class_attribute :iiif_print_solr_field_names, default: %w[alternative_title genre | ||
issn lccn oclcnum held_by text_direction | ||
page_number section author photographer | ||
volume issue_number geographic_coverage | ||
extent publication_date height width | ||
edition_number edition_name frequency preceded_by | ||
succeeded_by] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,10 @@ Gem::Specification.new do |spec| | |
spec.email = ['[email protected]', '[email protected]', | ||
'[email protected]', '[email protected]', '[email protected]', | ||
'[email protected]', '[email protected]'] | ||
spec.homepage = 'https://github.com/samvera-labs/iiif_print' | ||
spec.homepage = 'https://github.com/scientist-softserv/iiif_print/' | ||
spec.description = 'Gem/Engine for IIIF Print works in Hyrax-based Samvera Application.' | ||
spec.summary = <<-SUMMARY | ||
iiif_print is a Rails Engine gem providing model and administrative | ||
functions to Hyrax-based Samvera applications, for management of | ||
(primarily scanned) content. | ||
IiifPrint is a gem (Rails "engine") for Hyrax-based digital repository applications to support displaying parent/child works in the same viewer (Universal Viewer) and the ability to search OCR from the parent work to the child work(s). IiifPring was originally based off of the samvera-labs Newspaper gem. | ||
SUMMARY | ||
spec.license = 'Apache-2.0' | ||
spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR).select { |f| File.dirname(f) !~ %r{\A"?spec\/?} && f != 'bin/rails' } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module IiifPrint | ||
VERSION = '1.0.0'.freeze | ||
VERSION = '2.0.1'.freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters