Class: ContentEmbedding::VideoEmbedding

Inherits:
ContentEmbedding
  • Object
show all
Includes:
TextSearchable
Defined in:
app/models/content_embedding/video_embedding.rb

Overview

== Schema Information

Table name: content_embeddings_videos
Database name: primary

id :bigint not null, primary key
content_hash :string(32)
content_type :string default("primary"), not null
embeddable_type :string not null
embedding_dimensions :integer
embedding_model :string
locale :string default("en")
model :string
token_count :integer
unified_embedding :vector
created_at :timestamp not null
updated_at :timestamp not null
embeddable_id :bigint not null

Indexes

idx_content_embeddings_videos_embedding_model (embedding_model)
idx_content_embeddings_videos_unique (embeddable_id,content_type,locale) UNIQUE

Foreign Keys

fk_content_embeddings_videos_embeddable (embeddable_id => digital_assets.id) ON DELETE => cascade

ContentEmbedding STI subclass for video embeddings.

Constant Summary

Constants included from TextSearchable

TextSearchable::SIMILARITY_THRESHOLD

Belongs to collapse

Class Method Summary collapse

Methods included from TextSearchable

apply_locale_filter, generate_text_query_embedding, locale_filtered?, semantic_search

Class Method Details

.apply_published_filter(scope) ⇒ ActiveRecord::Relation

Filter to active (non-inactive) videos only

Parameters:

  • scope (ActiveRecord::Relation)

    relation to filter

Returns:

  • (ActiveRecord::Relation)


53
54
55
56
# File 'app/models/content_embedding/video_embedding.rb', line 53

def apply_published_filter(scope)
  scope.joins('INNER JOIN digital_assets ON digital_assets.id = content_embeddings_videos.embeddable_id')
       .where(digital_assets: { inactive: false })
end

.primary_contentActiveRecord::Relation<ContentEmbedding::VideoEmbedding>

A relation of ContentEmbedding::VideoEmbeddings that are primary content. Active Record Scope

Returns:

See Also:



45
# File 'app/models/content_embedding/video_embedding.rb', line 45

scope :primary_content, -> { where(content_type: 'primary') }

.transcript_contentActiveRecord::Relation<ContentEmbedding::VideoEmbedding>

A relation of ContentEmbedding::VideoEmbeddings that are transcript content. Active Record Scope

Returns:

See Also:



46
# File 'app/models/content_embedding/video_embedding.rb', line 46

scope :transcript_content, -> { where(content_type: 'transcript') }

Instance Method Details

#embeddableVideo Also known as: video

Returns:



40
# File 'app/models/content_embedding/video_embedding.rb', line 40

belongs_to :embeddable, class_name: 'Video'