Class: ContentEmbedding::ReviewsIoEmbedding

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

Overview

== Schema Information

Table name: content_embeddings_reviews_ios
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_reviews_ios_embedding_model (embedding_model)
idx_content_embeddings_reviews_ios_unique (embeddable_id,content_type,locale) UNIQUE

Foreign Keys

fk_content_embeddings_reviews_ios_embeddable (embeddable_id => reviews_io.id) ON DELETE => cascade

ContentEmbedding STI subclass for reviews io 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 reviews only

Parameters:

  • scope (ActiveRecord::Relation)

    relation to filter

Returns:

  • (ActiveRecord::Relation)


52
53
54
55
# File 'app/models/content_embedding/reviews_io_embedding.rb', line 52

def apply_published_filter(scope)
  scope.joins('INNER JOIN reviews_io ON reviews_io.id = content_embeddings_reviews_ios.embeddable_id')
       .where(reviews_io: { status: 'active' })
end

.primary_contentActiveRecord::Relation<ContentEmbedding::ReviewsIoEmbedding>

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

Returns:

See Also:



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

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

Instance Method Details

#embeddableReviewsIo Also known as: review

Returns:



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

belongs_to :embeddable, class_name: 'ReviewsIo'