diff options
Diffstat (limited to 'skate/map.go')
-rw-r--r-- | skate/map.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/skate/map.go b/skate/map.go index d6e37be..459558d 100644 --- a/skate/map.go +++ b/skate/map.go @@ -181,6 +181,23 @@ func MapperTitleSandcrawler(p []byte) (fields [][]byte, err error) { return fields, nil } +// MapperURLFromRef extracts the work, release ident, url and doc. Previously: +// parallel -j 16 --block 100M --pipe "jq -rc '[.work_ident, .release_ident, +// .biblio.url?] | @tsv'" ... +func MapperURLFromRef(p []byte) (fields [][]byte, err error) { + var ref Ref + if err := json.Unmarshal(p, &ref); err != nil { + return nil, err + } + fields := [][]byte{ + []byte(ref.WorkIdent), + []byte(ref.ReleaseIdent), + []byte(ref.Biblio.Url), + p, + } + return fields, nil +} + // MapperPartial works on partial documents. func MapperPartial(p []byte) (fields [][]byte, err error) { // XXX: slugify authors, how to compare two author strings? How do these |