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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user