aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-06-15 05:25:24 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-06-15 05:25:24 +0200
commit0b1060be325b061252f4c4b59d047a633f7de0d3 (patch)
tree8d5eb4200c4a498dad41ab32041fa047543ceea3 /skate
parent9522af0c93c41f8f623b05d5215c6690615b562b (diff)
downloadrefcat-0b1060be325b061252f4c4b59d047a633f7de0d3.tar.gz
refcat-0b1060be325b061252f4c4b59d047a633f7de0d3.zip
fix bug in duplication
* use new bref * an exact match should be smaller than other matches
Diffstat (limited to 'skate')
-rw-r--r--skate/zippy.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index 07b61c0..a6c5083 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -399,11 +399,9 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [
// list of deserialized bref docs, containing unique matches only (e.g. filter
// out things duplicate matches, e.g. from exact and fuzzy).
func uniqueMatches(docs []string, stats *statsAugment) (result []*BiblioRef, err error) {
- var (
- brefs []*BiblioRef
- bref BiblioRef
- )
+ var brefs []*BiblioRef
for _, doc := range docs {
+ var bref BiblioRef
if err := json.Unmarshal([]byte(doc), &bref); err != nil {
return nil, err
}
@@ -411,7 +409,7 @@ func uniqueMatches(docs []string, stats *statsAugment) (result []*BiblioRef, err
}
// Make sure exact matches come first.
sort.Slice(brefs, func(i, j int) bool {
- return brefs[i].MatchStatus != StatusExact.Short()
+ return brefs[i].MatchStatus == StatusExact.Short()
})
// We consider a match unique, if source and target match.
hash := func(bref *BiblioRef) string {