p3: keep original URLs on RRF/dedupe; rerank=false is not a merge

CanonicalURL is the dedupe key only. Hits keep the first source's
original URL, including a trailing slash. Dedupe has the same rule.
This commit is contained in:
2026-09-23 16:04:45 -07:00
parent b6e1cdf825
commit 1c57845ebd
4 changed files with 36 additions and 9 deletions
+2 -1
View File
@@ -79,13 +79,14 @@ func Dedupe(in []Hit) []Hit {
if canon == "" {
continue
}
h.URL = canon
if s, ok := seen[canon]; ok {
if len(h.Snippet) > len(s.h.Snippet) {
src := s.h.Source
keep := s.h.URL
sc := s.h.Score
s.h = h
s.h.Source = src
s.h.URL = keep
if sc > s.h.Score {
s.h.Score = sc
}