Skip packages without description text in vectorization

Packages with neither description nor long description cannot be
embedded at all; they used to fail on every run. Exclude them from
the scope instead.
This commit is contained in:
Christoph Haas 2026-08-23 00:20:30 +02:00
parent 2b79470feb
commit bada261841

View file

@ -11,7 +11,11 @@ namespace :debshots do
logger.level = Logger::INFO logger.level = Logger::INFO
force = ENV['FORCE'].present? force = ENV['FORCE'].present?
scope = force ? Package.all : Package.where(embedding: nil) # Packages without any description text cannot be embedded at all -
# exclude them so they do not fail on every single run.
base_scope = Package.where("COALESCE(description, '') <> '' OR " \
"COALESCE(long_description, '') <> ''")
scope = force ? base_scope : base_scope.where(embedding: nil)
total = scope.count total = scope.count
if total.zero? if total.zero?