Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update ActiveFedora to 12.0 #2256

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/hyrax/homepage_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ def recent
end

def sort_field
"#{Solrizer.solr_name('system_create', :stored_sortable, type: :date)} desc"
"#{ActiveFedora.index_field_mapper.solr_name('system_create', :stored_sortable, type: :date)} desc"
end
end
4 changes: 2 additions & 2 deletions app/helpers/hyrax/hyrax_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def link_to_facet(item, field)
# @return [ActiveSupport::SafeBuffer] the html_safe link
def link_to_facet_list(values, solr_field, empty_message = "No value entered", separator = ", ")
return empty_message if values.blank?
facet_field = Solrizer.solr_name(solr_field, :facetable)
facet_field = ActiveFedora.index_field_mapper.solr_name(solr_field, :facetable)
safe_join(values.map { |item| link_to_facet(item, facet_field) }, separator)
end

Expand Down Expand Up @@ -298,7 +298,7 @@ def search_action_for_dashboard
def search_state_with_facets(params, facet = {})
state = Blacklight::SearchState.new(params, CatalogController.blacklight_config)
return state.params if facet.none?
state.add_facet_params(Solrizer.solr_name(facet.keys.first, :facetable),
state.add_facet_params(ActiveFedora.index_field_mapper.solr_name(facet.keys.first, :facetable),
facet.values.first)
end

Expand Down
2 changes: 1 addition & 1 deletion app/indexers/hyrax/admin_set_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AdminSetIndexer < ActiveFedora::IndexingService
def generate_solr_document
super.tap do |solr_doc|
# Makes Admin Sets show under the "Admin Sets" tab
Solrizer.set_field(solr_doc, 'generic_type', 'Admin Set', :facetable)
ActiveFedora.index_field_mapper.set_field(solr_doc, 'generic_type', 'Admin Set', :facetable)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/indexers/hyrax/collection_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Hyrax
class CollectionIndexer < Hydra::PCDM::CollectionIndexer
include Hyrax::IndexesThumbnails

STORED_LONG = Solrizer::Descriptor.new(:long, :stored)
STORED_LONG = ActiveFedora::Indexing::Descriptor.new(:long, :stored)

self.thumbnail_path_service = Hyrax::CollectionThumbnailPathService

Expand All @@ -11,9 +11,9 @@ class CollectionIndexer < Hydra::PCDM::CollectionIndexer
def generate_solr_document
super.tap do |solr_doc|
# Makes Collections show under the "Collections" tab
Solrizer.set_field(solr_doc, 'generic_type', 'Collection', :facetable)
ActiveFedora.index_field_mapper.set_field(solr_doc, 'generic_type', 'Collection', :facetable)
# Index the size of the collection in bytes
solr_doc[Solrizer.solr_name(:bytes, STORED_LONG)] = object.bytes
solr_doc[ActiveFedora.index_field_mapper.solr_name(:bytes, STORED_LONG)] = object.bytes
solr_doc['visibility_ssi'] = object.visibility

object.in_collections.each do |col|
Expand Down
24 changes: 12 additions & 12 deletions app/indexers/hyrax/deep_indexing_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def default_accept_header
# @param [Array] val an array of two elements, first is a string (the uri) and the second is a hash with one key: `:label`
def append_label_and_uri(solr_doc, solr_field_key, field_info, val)
val = val.solrize
self.class.create_and_insert_terms(solr_field_key,
val.first,
field_info.behaviors, solr_doc)
ActiveFedora::Indexing::Inserter.create_and_insert_terms(solr_field_key,
val.first,
field_info.behaviors, solr_doc)
return unless val.last.is_a? Hash
self.class.create_and_insert_terms("#{solr_field_key}_label",
label(val),
field_info.behaviors, solr_doc)
ActiveFedora::Indexing::Inserter.create_and_insert_terms("#{solr_field_key}_label",
label(val),
field_info.behaviors, solr_doc)
end

# Use this method to append a string value from a controlled vocabulary field
Expand All @@ -83,12 +83,12 @@ def append_label_and_uri(solr_doc, solr_field_key, field_info, val)
# @param [Hash] field_info
# @param [String] val
def append_label(solr_doc, solr_field_key, field_info, val)
self.class.create_and_insert_terms(solr_field_key,
val,
field_info.behaviors, solr_doc)
self.class.create_and_insert_terms("#{solr_field_key}_label",
val,
field_info.behaviors, solr_doc)
ActiveFedora::Indexing::Inserter.create_and_insert_terms(solr_field_key,
val,
field_info.behaviors, solr_doc)
ActiveFedora::Indexing::Inserter.create_and_insert_terms("#{solr_field_key}_label",
val,
field_info.behaviors, solr_doc)
end

# Return a label for the solrized term:
Expand Down
2 changes: 1 addition & 1 deletion app/indexers/hyrax/file_set_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Hyrax
class FileSetIndexer < ActiveFedora::IndexingService
include Hyrax::IndexesThumbnails
include Hyrax::IndexesBasicMetadata
STORED_LONG = Solrizer::Descriptor.new(:long, :stored)
STORED_LONG = ActiveFedora::Indexing::Descriptor.new(:long, :stored)

def generate_solr_document
super.tap do |solr_doc|
Expand Down
8 changes: 4 additions & 4 deletions app/indexers/hyrax/indexes_workflow.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Hyrax
module IndexesWorkflow
STORED_BOOL = Solrizer::Descriptor.new(:boolean, :stored, :indexed)
STORED_BOOL = ActiveFedora::Indexing::Descriptor.new(:boolean, :stored, :indexed)

mattr_accessor :suppressed_field, instance_writer: false do
Solrizer.solr_name('suppressed', STORED_BOOL)
ActiveFedora.index_field_mapper.solr_name('suppressed', STORED_BOOL)
end

# Adds thumbnail indexing to the solr document
Expand Down Expand Up @@ -31,11 +31,11 @@ def index_workflow_fields(solr_document)
end

def workflow_state_name_field
@workflow_state_name_field ||= Solrizer.solr_name('workflow_state_name', :symbol)
@workflow_state_name_field ||= ActiveFedora.index_field_mapper.solr_name('workflow_state_name', :symbol)
end

def workflow_role_field
@workflow_role_field ||= Solrizer.solr_name('actionable_workflow_roles', :symbol)
@workflow_role_field ||= ActiveFedora.index_field_mapper.solr_name('actionable_workflow_roles', :symbol)
end

def workflow_roles(entity)
Expand Down
2 changes: 1 addition & 1 deletion app/indexers/hyrax/work_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def generate_solr_document
solr_doc['member_ids_ssim'] = object.member_ids
solr_doc['member_of_collections_ssim'] = object.member_of_collections.map(&:first_title)
solr_doc['member_of_collection_ids_ssim'] = object.member_of_collections.map(&:id)
Solrizer.set_field(solr_doc, 'generic_type', 'Work', :facetable)
ActiveFedora.index_field_mapper.set_field(solr_doc, 'generic_type', 'Work', :facetable)

# This enables us to return a Work when we have a FileSet that matches
# the search query. While at the same time allowing us not to return Collections
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/hyrax/collection_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ def size_for_work(work_id)
# Field name to look up when locating the size of each file in Solr.
# Override for your own installation if using something different
def file_size_field
Solrizer.solr_name(:file_size, Hyrax::FileSetIndexer::STORED_LONG)
ActiveFedora.index_field_mapper.solr_name(:file_size, Hyrax::FileSetIndexer::STORED_LONG)
end

# Solr field name works use to index member ids
def member_ids_field
Solrizer.solr_name('member_ids', :symbol)
ActiveFedora.index_field_mapper.solr_name('member_ids', :symbol)
end

def destroy_permission_template
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/hyrax/file_set/querying.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Querying

module ClassMethods
def where_digest_is(digest_string)
where Solrizer.solr_name('digest', :symbol) => urnify(digest_string)
where ActiveFedora.index_field_mapper.solr_name('digest', :symbol) => urnify(digest_string)
end

def urnify(digest_string)
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/hyrax/human_readable_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def human_readable_type

def to_solr(solr_doc = {})
super(solr_doc).tap do |doc|
doc[Solrizer.solr_name('human_readable_type', :facetable)] = human_readable_type
doc[Solrizer.solr_name('human_readable_type', :stored_searchable)] = human_readable_type
doc[ActiveFedora.index_field_mapper.solr_name('human_readable_type', :facetable)] = human_readable_type
doc[ActiveFedora.index_field_mapper.solr_name('human_readable_type', :stored_searchable)] = human_readable_type
end
end
end
Expand Down
46 changes: 23 additions & 23 deletions app/models/concerns/hyrax/solr_document/characterization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,103 +3,103 @@ module SolrDocument
# TODO: aside from height and width, I don't think any of these other terms are indexed by default. - Justin 3/2016
module Characterization
def byte_order
self[Solrizer.solr_name("byte_order")]
self[ActiveFedora.index_field_mapper.solr_name("byte_order")]
end

def capture_device
self[Solrizer.solr_name("capture_device")]
self[ActiveFedora.index_field_mapper.solr_name("capture_device")]
end

def color_map
self[Solrizer.solr_name("color_map")]
self[ActiveFedora.index_field_mapper.solr_name("color_map")]
end

def color_space
self[Solrizer.solr_name("color_space")]
self[ActiveFedora.index_field_mapper.solr_name("color_space")]
end

def compression
self[Solrizer.solr_name("compression")]
self[ActiveFedora.index_field_mapper.solr_name("compression")]
end

def gps_timestamp
self[Solrizer.solr_name("gps_timestamp")]
self[ActiveFedora.index_field_mapper.solr_name("gps_timestamp")]
end

def height
self['height_is']
end

def image_producer
self[Solrizer.solr_name("image_producer")]
self[ActiveFedora.index_field_mapper.solr_name("image_producer")]
end

def latitude
self[Solrizer.solr_name("latitude")]
self[ActiveFedora.index_field_mapper.solr_name("latitude")]
end

def longitude
self[Solrizer.solr_name("longitude")]
self[ActiveFedora.index_field_mapper.solr_name("longitude")]
end

def orientation
self[Solrizer.solr_name("orientation")]
self[ActiveFedora.index_field_mapper.solr_name("orientation")]
end

def profile_name
self[Solrizer.solr_name("profile_name")]
self[ActiveFedora.index_field_mapper.solr_name("profile_name")]
end

def profile_version
self[Solrizer.solr_name("profile_version")]
self[ActiveFedora.index_field_mapper.solr_name("profile_version")]
end

def scanning_software
self[Solrizer.solr_name("scanning_software")]
self[ActiveFedora.index_field_mapper.solr_name("scanning_software")]
end

def width
self['width_is']
end

def format_label
self[Solrizer.solr_name("format_label")]
self[ActiveFedora.index_field_mapper.solr_name("format_label")]
end

def file_size
self[Solrizer.solr_name("file_size")]
self[ActiveFedora.index_field_mapper.solr_name("file_size")]
end

def filename
self[Solrizer.solr_name("filename")]
self[ActiveFedora.index_field_mapper.solr_name("filename")]
end

def well_formed
self[Solrizer.solr_name("well_formed")]
self[ActiveFedora.index_field_mapper.solr_name("well_formed")]
end

def page_count
self[Solrizer.solr_name("page_count")]
self[ActiveFedora.index_field_mapper.solr_name("page_count")]
end

def file_title
self[Solrizer.solr_name("file_title")]
self[ActiveFedora.index_field_mapper.solr_name("file_title")]
end

def duration
self[Solrizer.solr_name("duration")]
self[ActiveFedora.index_field_mapper.solr_name("duration")]
end

def sample_rate
self[Solrizer.solr_name("sample_rate")]
self[ActiveFedora.index_field_mapper.solr_name("sample_rate")]
end

def last_modified
self[Solrizer.solr_name("last_modified")]
self[ActiveFedora.index_field_mapper.solr_name("last_modified")]
end

def original_checksum
self[Solrizer.solr_name("original_checksum")]
self[ActiveFedora.index_field_mapper.solr_name("original_checksum")]
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/hyrax/solr_document/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def attribute(name, type, field)
end

def solr_name(*args)
Solrizer.solr_name(*args)
ActiveFedora.index_field_mapper.solr_name(*args)
end
end

Expand Down Expand Up @@ -77,7 +77,7 @@ def self.coerce(input)
attribute :thumbnail_path, Solr::String, CatalogController.blacklight_config.index.thumbnail_field
attribute :label, Solr::String, solr_name('label')
attribute :file_format, Solr::String, solr_name('file_format')
attribute :suppressed?, Solr::String, solr_name('suppressed', Solrizer::Descriptor.new(:boolean, :stored, :indexed))
attribute :suppressed?, Solr::String, solr_name('suppressed', ActiveFedora::Indexing::Descriptor.new(:boolean, :stored, :indexed))

attribute :date_modified, Solr::Date, solr_name('date_modified', :stored_sortable, type: :date)
attribute :date_uploaded, Solr::Date, solr_name('date_uploaded', :stored_sortable, type: :date)
Expand Down
6 changes: 3 additions & 3 deletions app/models/concerns/hyrax/solr_document_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def admin_set?

# Method to return the ActiveFedora model
def hydra_model
first(Solrizer.solr_name('has_model', :symbol)).constantize
first(ActiveFedora.index_field_mapper.solr_name('has_model', :symbol)).constantize
end

def depositor(default = '')
val = first(Solrizer.solr_name('depositor'))
val = first(ActiveFedora.index_field_mapper.solr_name('depositor'))
val.present? ? val : default
end

Expand All @@ -85,7 +85,7 @@ def creator
else
:stored_searchable
end
fetch(Solrizer.solr_name('creator', descriptor), [])
fetch(ActiveFedora.index_field_mapper.solr_name('creator', descriptor), [])
end

def visibility
Expand Down
1 change: 0 additions & 1 deletion app/models/concerns/hyrax/work_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module WorkBehavior
include Permissions
include Serializers
include Hydra::WithDepositor
include Solrizer::Common
include HasRepresentative
include HasRendering
include WithFileSets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def search_path(value)
end

def search_field
ERB::Util.h(Solrizer.solr_name(options.fetch(:search_field, field), :facetable, type: :string))
ERB::Util.h(ActiveFedora.index_field_mapper.solr_name(options.fetch(:search_field, field), :facetable, type: :string))
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/search_builders/hyrax/collection_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def discovery_permissions

# @return [String] Solr field name indicating default sort order
def sort_field
Solrizer.solr_name('title', :sortable)
ActiveFedora.index_field_mapper.solr_name('title', :sortable)
end

# This overrides the models in FilterByType
Expand Down
2 changes: 1 addition & 1 deletion app/search_builders/hyrax/deposit_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def include_depositor_facet(solr_parameters)
end

def self.depositor_field
@depositor_field ||= Solrizer.solr_name('depositor', :symbol).freeze
@depositor_field ||= ActiveFedora.index_field_mapper.solr_name('depositor', :symbol).freeze
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/services/hyrax/collection_size_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def collection_search_builder
end

def size_field
Solrizer.solr_name(:file_size, :symbol)
ActiveFedora.index_field_mapper.solr_name(:file_size, :symbol)
end

def max_collection_size
Expand Down
2 changes: 1 addition & 1 deletion app/services/hyrax/statistics/file_sets/by_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ByFormat < Statistics::TermQuery

# Returns 'file_format_sim'
def index_key
Solrizer.solr_name('file_format', :facetable)
ActiveFedora.index_field_mapper.solr_name('file_format', :facetable)
end
end
end
Expand Down
Loading