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.
This commit is contained in:
Christoph Haas 2026-08-23 21:25:28 +02:00
parent 07be9eadcc
commit fd5747c6ab

View file

@ -425,7 +425,10 @@ class PackagesController < ApplicationController
logger.debug "Query '#{query}' has no lexical overlap with package data" logger.debug "Query '#{query}' has no lexical overlap with package data"
end 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 # Queries that share no vocabulary with our package data can produce
# no meaningful results. Skip the vector service round-trip and show # no meaningful results. Skip the vector service round-trip and show