From bada261841050199f8f8da0f54a273b2667f795d Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sun, 23 Aug 2026 00:20:30 +0200 Subject: [PATCH] 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. --- lib/tasks/vectorize_packages.rake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tasks/vectorize_packages.rake b/lib/tasks/vectorize_packages.rake index 4fbfe7b..66bf7a2 100644 --- a/lib/tasks/vectorize_packages.rake +++ b/lib/tasks/vectorize_packages.rake @@ -11,7 +11,11 @@ namespace :debshots do logger.level = Logger::INFO 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 if total.zero?