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
+4 -2
View File
@@ -97,18 +97,20 @@ func rrfMerge(lists [][]Hit) []Hit {
var order []string
for _, list := range lists {
for r, h := range list {
c := CanonicalURL(h.URL)
orig := h.URL
c := CanonicalURL(orig)
if c == "" {
continue
}
h.URL = c
sc := 1.0 / float64(rrfK+r+1)
if a, ok := seen[c]; ok {
a.s += sc
if len(h.Snippet) > len(a.h.Snippet) {
src := a.h.Source
keep := a.h.URL
a.h = h
a.h.Source = src
a.h.URL = keep
}
continue
}