diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-07-28 13:28:29 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-07-28 13:28:29 +0200 |
commit | 2e008b0b3a04c1c726ac359b017baed7e0a97909 (patch) | |
tree | dcea973fbf7872244bb77c0a539096bc5eb030ca | |
parent | 794d69f9eec40c6b83beddf03611d13c4f8a2910 (diff) | |
download | refcat-2e008b0b3a04c1c726ac359b017baed7e0a97909.tar.gz refcat-2e008b0b3a04c1c726ac359b017baed7e0a97909.zip |
leave ref.index unchanged
previously, we started with 0-indexed input, but wanted 1-indexed values
so we added increments at various points which probably lead to bug
(missing refs), since at one point we would fuse the original ref data
(w/o increments) with the matched data (w/ increments); with
scholar:528804ad2e55983cf3e5e6659d8f46db0cab02b7 we can now leave
indices as is
-rw-r--r-- | skate/reduce.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/skate/reduce.go b/skate/reduce.go index e169ce6..ed8035d 100644 --- a/skate/reduce.go +++ b/skate/reduce.go @@ -77,13 +77,13 @@ func ZippyExact(releases, refs io.Reader, matchResult MatchResult, w io.Writer) continue } bref.Reset() - bref.Key = fmt.Sprintf("%s_%d", ref.ReleaseIdent, ref.Index+1) + bref.Key = fmt.Sprintf("%s_%d", ref.ReleaseIdent, ref.Index) bref.IndexedTs = ts bref.SourceReleaseIdent = ref.ReleaseIdent bref.SourceWorkIdent = ref.WorkIdent bref.SourceReleaseStage = ref.ReleaseStage bref.SourceYear = fmt.Sprintf("%d", ref.ReleaseYear) - bref.RefIndex = ref.Index + 1 // we want 1-index (also helps with omitempty); TODO: was fixed with scholar:528804ad2e55983cf3e5e6659d8f46db0cab02b7 + bref.RefIndex = ref.Index bref.RefKey = ref.Key bref.TargetReleaseIdent = target.Ident bref.TargetWorkIdent = target.WorkID @@ -134,7 +134,7 @@ func ZippyExactReleases(olr, releases io.Reader, matchResult MatchResult, w io.W bref.SourceWorkIdent = re.WorkID bref.SourceReleaseStage = re.ReleaseStage bref.SourceYear = fmt.Sprintf("%d", re.ReleaseYear()) - bref.RefIndex = re.Extra.Skate.Ref.Index + 1 // we want 1-index (also helps with omitempty) + bref.RefIndex = re.Extra.Skate.Ref.Index bref.RefKey = re.Extra.Skate.Ref.Key bref.TargetOpenLibraryWork = target.WorkID bref.MatchProvenance = re.Extra.Skate.Ref.Source @@ -344,7 +344,7 @@ func ZippyVerifyRefsOpenLibrary(olr, refs io.Reader, w io.Writer) error { bref.SourceWorkIdent = ref.WorkID bref.SourceReleaseStage = ref.ReleaseStage bref.SourceYear = fmt.Sprintf("%d", ref.ReleaseYear()) - bref.RefIndex = ref.Extra.Skate.Ref.Index + 1 // we want 1-index (also helps with omitempty) + bref.RefIndex = ref.Extra.Skate.Ref.Index bref.RefKey = ref.Extra.Skate.Ref.Key bref.TargetOpenLibraryWork = openLibraryWorkID bref.MatchProvenance = ref.Extra.Skate.Ref.Source @@ -400,7 +400,7 @@ func ZippyWayback(refs, cdx io.Reader, w io.Writer) error { if ref.ReleaseYear > 1800 { bref.SourceYear = fmt.Sprintf("%d", ref.ReleaseYear) } - bref.RefIndex = ref.Index + 1 // we want 1-index (also helps with omitempty) + bref.RefIndex = ref.Index bref.RefKey = ref.Key if cdx.NumRows == 0 { bref.TargetURL = cdx.Line @@ -564,7 +564,7 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [ seen.Add(s) } for _, r := range refs { - s := r.Key + fmt.Sprintf("%d", r.Index+1) + s := r.Key + fmt.Sprintf("%d", r.Index) if seen.Contains(s) { stats.skipMatchedRef++ log.Printf("skip-matched-ref [%d]: from %d matches; ident=%v, title=%s, key=%v, index=%d", |