Class: ContentEmbedding::ReviewsIoEmbedding
- Inherits:
-
ContentEmbedding
- Object
- ContentEmbedding
- ContentEmbedding::ReviewsIoEmbedding
- Includes:
- TextSearchable
- Defined in:
- app/models/content_embedding/reviews_io_embedding.rb
Constant Summary
Constants included from TextSearchable
TextSearchable::EMBEDDING_MODEL, TextSearchable::SIMILARITY_THRESHOLD
Belongs to collapse
- #embeddable ⇒ ReviewsIo (also: #review)
Class Method Summary collapse
-
.apply_published_filter(scope) ⇒ Object
Filter to active reviews only.
-
.primary_content ⇒ ActiveRecord::Relation<ContentEmbedding::ReviewsIoEmbedding>
A relation of ContentEmbedding::ReviewsIoEmbeddings that are primary content.
-
.with_embedding ⇒ ActiveRecord::Relation<ContentEmbedding::ReviewsIoEmbedding>
A relation of ContentEmbedding::ReviewsIoEmbeddings that are with embedding.
Methods included from TextSearchable
apply_locale_filter, generate_text_query_embedding, locale_filtered?, semantic_search
Class Method Details
.apply_published_filter(scope) ⇒ Object
Filter to active reviews only
48 49 50 51 |
# File 'app/models/content_embedding/reviews_io_embedding.rb', line 48 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_content ⇒ ActiveRecord::Relation<ContentEmbedding::ReviewsIoEmbedding>
A relation of ContentEmbedding::ReviewsIoEmbeddings that are primary content. Active Record Scope
43 |
# File 'app/models/content_embedding/reviews_io_embedding.rb', line 43 scope :primary_content, -> { where(content_type: 'primary') } |
.with_embedding ⇒ ActiveRecord::Relation<ContentEmbedding::ReviewsIoEmbedding>
A relation of ContentEmbedding::ReviewsIoEmbeddings that are with embedding. Active Record Scope
44 |
# File 'app/models/content_embedding/reviews_io_embedding.rb', line 44 scope :with_embedding, -> { where.not(embedding: nil) } |
Instance Method Details
#embeddable ⇒ ReviewsIo Also known as: review
38 |
# File 'app/models/content_embedding/reviews_io_embedding.rb', line 38 belongs_to :embeddable, class_name: 'ReviewsIo' |