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:
parent
07be9eadcc
commit
fd5747c6ab
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue