aboutsummaryrefslogtreecommitdiffstats
path: root/skate/zippy.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/zippy.go')
-rw-r--r--skate/zippy.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index febd4c5..59951e2 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -375,13 +375,16 @@ func ZippyBrefAugment(bref, raw io.Reader, w io.Writer) error {
// removeSelfLinks removes self-referential links. TODO: Those should be caught
// at the root cause.
func removeSelfLinks(brefs []*BiblioRef) (result []*BiblioRef) {
+ var i int
for _, bref := range brefs {
if bref.SourceReleaseIdent == bref.TargetReleaseIdent {
continue
}
- result = append(result, bref)
+ brefs[i] = bref
+ i++
}
- return result
+ brefs = brefs[:i]
+ return brefs
}
// deduplicateBrefs deduplicates by the document id (for elasticsearch), which
@@ -392,6 +395,12 @@ func deduplicateBrefs(brefs []*BiblioRef) []*BiblioRef {
switch {
case brefs[i].MatchStatus == StatusExact.Short():
return true
+ case brefs[i].MatchStatus == StatusStrong.Short():
+ return true
+ case brefs[i].MatchStatus == StatusWeak.Short():
+ return false
+ case brefs[i].MatchStatus == StatusAmbiguous.Short():
+ return false
case brefs[i].MatchStatus != StatusUnmatched.Short():
return true
default:
@@ -401,6 +410,7 @@ func deduplicateBrefs(brefs []*BiblioRef) []*BiblioRef {
var (
unique []*BiblioRef
seen = set.New()
+ // i int
)
for _, v := range brefs {
if seen.Contains(v.Key) {