Sha256: 13e62cc36fa8a22e8414e8fa82a474d890aee23428c4905db9a647d8fc99b105
Contents?: true
Size: 1.05 KB
Versions: 10
Compression:
Stored size: 1.05 KB
Contents
# # An Item is a member of a Collection -- i.e., a "work" -- the principal describable resource. # # Examples: photograph, book, article, sound recording, video, etc. # class Item < Ddr::Models::Base include Ddr::Models::HasChildren include Ddr::Models::HasStructMetadata has_many :children, property: :is_part_of, class_name: 'Component' belongs_to :parent, property: :is_member_of_collection, class_name: 'Collection' alias_method :components, :children alias_method :component_ids, :child_ids alias_method :parts, :children alias_method :part_ids, :child_ids alias_method :collection, :parent alias_method :collection_id, :parent_id alias_method :collection=, :parent= def publishable? parent.present? && parent.published? end def children_having_extracted_text Ddr::Index::Query.build(self) do |item| is_part_of item where attached_files_having_content: "extractedText" fields :id, :extracted_text end end def all_text children_having_extracted_text.docs.map(&:extracted_text).flatten end end
Version data entries
10 entries across 10 versions & 1 rubygems