From fd5747c6ab846ef7788a0874ac7c66997d0ecb7c Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sun, 23 Aug 2026 21:25:28 +0200 Subject: [PATCH] Deduplicate search results by package name If the database ever contains duplicate-name rows again, users should not see the same package twice in the results. --- app/controllers/packages_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index eec639d..602595b 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -425,7 +425,10 @@ class PackagesController < ApplicationController logger.debug "Query '#{query}' has no lexical overlap with package data" end - results = (prefix_matches + token_matches + semantic).uniq(&:id) + # Deduplicate by NAME, not id: if the database ever contains + # duplicate rows (see the packages_name_key incident) users should + # not see the same package twice. + results = (prefix_matches + token_matches + semantic).uniq(&:name) # Queries that share no vocabulary with our package data can produce # no meaningful results. Skip the vector service round-trip and show