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