Class: Embedding::CoverageReport
- Inherits:
-
Object
- Object
- Embedding::CoverageReport
- Includes:
- Calculations
- Defined in:
- app/queries/embedding/coverage_report.rb
Overview
Builds the embedding dashboard's coverage metrics from matching eligible and
searchable scopes. A physical embedding row only counts when Sunny can search
its current unified vector; chunked records count once.
Defined Under Namespace
Modules: Calculations Classes: Breakdowns
Constant Summary collapse
- CACHE_KEY =
'embedding_coverage_report/v1'- CACHE_TTL =
1.minute
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(article_types:, cache: Rails.cache) ⇒ CoverageReport
constructor
A new instance of CoverageReport.
Constructor Details
#initialize(article_types:, cache: Rails.cache) ⇒ CoverageReport
Returns a new instance of CoverageReport.
27 28 29 30 31 32 33 34 35 36 |
# File 'app/queries/embedding/coverage_report.rb', line 27 def initialize(article_types:, cache: Rails.cache) @article_types = article_types @cache = cache @candidate_scopes = build_candidate_scopes @searchable_embeddings = @breakdowns = Breakdowns.new( candidate_scopes: @candidate_scopes, searchable_embeddings: @searchable_embeddings ) end |
Instance Method Details
#call ⇒ Object
38 39 40 |
# File 'app/queries/embedding/coverage_report.rb', line 38 def call cache.fetch(cache_key, expires_in: CACHE_TTL, race_condition_ttl: 10.seconds) { build_report } end |