Module: Hyrax::IndexesWorkflow
- Included in:
- WorkIndexer
- Defined in:
- app/indexers/hyrax/indexes_workflow.rb
Instance Method Summary collapse
-
#generate_solr_document ⇒ Object
Adds thumbnail indexing to the solr document.
-
#index_suppressed(solr_document) ⇒ Object
Write the suppressed status into the solr_document.
-
#index_workflow_fields(solr_document) ⇒ Object
Write the workflow roles and state so one can see where the document moves to next.
- #workflow_role_field ⇒ Object
- #workflow_roles(entity) ⇒ Object
- #workflow_state_name_field ⇒ Object
Instance Method Details
#generate_solr_document ⇒ Object
Adds thumbnail indexing to the solr document
9 10 11 12 13 14 |
# File 'app/indexers/hyrax/indexes_workflow.rb', line 9 def generate_solr_document super.tap do |solr_doc| index_suppressed(solr_doc) index_workflow_fields(solr_doc) end end |
#index_suppressed(solr_document) ⇒ Object
Write the suppressed status into the solr_document
18 19 20 |
# File 'app/indexers/hyrax/indexes_workflow.rb', line 18 def index_suppressed(solr_document) solr_document[suppressed_field] = object.suppressed? end |
#index_workflow_fields(solr_document) ⇒ Object
Write the workflow roles and state so one can see where the document moves to next
24 25 26 27 28 29 30 |
# File 'app/indexers/hyrax/indexes_workflow.rb', line 24 def index_workflow_fields(solr_document) entity = Sipity::Entity(object) solr_document[workflow_role_field] = workflow_roles(entity).map { |role| "#{entity.workflow..source_id}-#{entity.workflow.name}-#{role}" } solr_document[workflow_state_name_field] = entity.workflow_state.name if entity.workflow_state rescue Sipity::ConversionError nil end |
#workflow_role_field ⇒ Object
36 37 38 |
# File 'app/indexers/hyrax/indexes_workflow.rb', line 36 def workflow_role_field "actionable_workflow_roles_ssim" end |
#workflow_roles(entity) ⇒ Object
40 41 42 |
# File 'app/indexers/hyrax/indexes_workflow.rb', line 40 def workflow_roles(entity) Hyrax::Workflow::PermissionQuery.scope_roles_associated_with_the_given_entity(entity: entity) end |
#workflow_state_name_field ⇒ Object
32 33 34 |
# File 'app/indexers/hyrax/indexes_workflow.rb', line 32 def workflow_state_name_field "workflow_state_name_ssim" end |