Class: ContentEmbedding::ItemEmbedding
- Inherits:
-
ContentEmbedding
- Object
- ContentEmbedding
- ContentEmbedding::ItemEmbedding
- Includes:
- TextSearchable
- Defined in:
- app/models/content_embedding/item_embedding.rb
Constant Summary
Constants included from TextSearchable
TextSearchable::EMBEDDING_MODEL, TextSearchable::SIMILARITY_THRESHOLD
Belongs to collapse
- #embeddable ⇒ Item (also: #item)
Class Method Summary collapse
-
.apply_published_filter(scope) ⇒ Object
Filter to non-discontinued items only.
-
.primary_content ⇒ ActiveRecord::Relation<ContentEmbedding::ItemEmbedding>
A relation of ContentEmbedding::ItemEmbeddings that are primary content.
-
.specifications_content ⇒ ActiveRecord::Relation<ContentEmbedding::ItemEmbedding>
A relation of ContentEmbedding::ItemEmbeddings that are specifications content.
-
.with_embedding ⇒ ActiveRecord::Relation<ContentEmbedding::ItemEmbedding>
A relation of ContentEmbedding::ItemEmbeddings 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 non-discontinued items only
49 50 51 52 |
# File 'app/models/content_embedding/item_embedding.rb', line 49 def apply_published_filter(scope) scope.joins('INNER JOIN items ON items.id = content_embeddings_items.embeddable_id') .where(items: { is_discontinued: false }) end |
.primary_content ⇒ ActiveRecord::Relation<ContentEmbedding::ItemEmbedding>
A relation of ContentEmbedding::ItemEmbeddings that are primary content. Active Record Scope
43 |
# File 'app/models/content_embedding/item_embedding.rb', line 43 scope :primary_content, -> { where(content_type: 'primary') } |
.specifications_content ⇒ ActiveRecord::Relation<ContentEmbedding::ItemEmbedding>
A relation of ContentEmbedding::ItemEmbeddings that are specifications content. Active Record Scope
44 |
# File 'app/models/content_embedding/item_embedding.rb', line 44 scope :specifications_content, -> { where(content_type: 'specifications') } |
.with_embedding ⇒ ActiveRecord::Relation<ContentEmbedding::ItemEmbedding>
A relation of ContentEmbedding::ItemEmbeddings that are with embedding. Active Record Scope
45 |
# File 'app/models/content_embedding/item_embedding.rb', line 45 scope :with_embedding, -> { where.not(embedding: nil) } |
Instance Method Details
#embeddable ⇒ Item Also known as: item
38 |
# File 'app/models/content_embedding/item_embedding.rb', line 38 belongs_to :embeddable, class_name: 'Item' |