aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-24 22:07:33 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-24 22:07:33 +0200
commit58bbcd71234749fa9e03ab7c8811bc6e078d906c (patch)
treed6efaee1ca2a2233a09f4e60afd9cbbb6fe2426e /skate
parentc0090028f26cefb7f609c2ad07a8dc6a253c7cf9 (diff)
downloadrefcat-58bbcd71234749fa9e03ab7c8811bc6e078d906c.tar.gz
refcat-58bbcd71234749fa9e03ab7c8811bc6e078d906c.zip
refactor to container name
Diffstat (limited to 'skate')
-rw-r--r--skate/cmd/skate-map/main.go4
-rw-r--r--skate/map.go20
2 files changed, 12 insertions, 12 deletions
diff --git a/skate/cmd/skate-map/main.go b/skate/cmd/skate-map/main.go
index 132d4ab..572ecec 100644
--- a/skate/cmd/skate-map/main.go
+++ b/skate/cmd/skate-map/main.go
@@ -74,8 +74,8 @@ func main() {
"ty": skate.MapperTitleNysiis,
"ts": skate.MapperTitleSandcrawler,
"ru": skate.MapperURLFromRef,
- "cti": skate.MapperContainerTitle,
- "cts": skate.MapperContainerTitleSandcrawler,
+ "cni": skate.MapperContainerName,
+ "cns": skate.MapperContainerNameSandcrawler,
}
if *logFile != "" {
f, err := os.OpenFile(*logFile, os.O_CREATE|os.O_APPEND, 0644)
diff --git a/skate/map.go b/skate/map.go
index 0c55eed..a72ad89 100644
--- a/skate/map.go
+++ b/skate/map.go
@@ -24,10 +24,10 @@ type TitleDoc struct {
Title string `json:"title"`
}
-// ContainerTitleDoc is a document with a container title.
-type ContainerTitleDoc struct {
+// ContainerNameDoc is a document with a container title.
+type ContainerNameDoc struct {
Biblio struct {
- ContainerTitle string `json:"container_title"`
+ ContainerName string `json:"container_title"`
} `json:"biblio"`
}
@@ -197,23 +197,23 @@ func MapperTitleSandcrawler(p []byte) (fields [][]byte, err error) {
return fields, nil
}
-// MapperContainerTitle extracts (container_title, doc).
-func MapperContainerTitle(p []byte) ([][]byte, error) {
+// MapperContainerName extracts (container_title, doc).
+func MapperContainerName(p []byte) ([][]byte, error) {
var (
- doc ContainerTitleDoc
+ doc ContainerNameDoc
key []byte
)
if err := json.Unmarshal(p, &doc); err != nil {
return nil, err
} else {
- key = []byte(wsReplacer.Replace(strings.TrimSpace(doc.Biblio.ContainerTitle)))
+ key = []byte(wsReplacer.Replace(strings.TrimSpace(doc.Biblio.ContainerName)))
}
return [][]byte{key, p}, nil
}
-// MapperContainerTitleSandcrawler extracts (container_title, doc).
-func MapperContainerTitleSandcrawler(p []byte) (fields [][]byte, err error) {
- if fields, err = MapperContainerTitle(p); err != nil {
+// MapperContainerNameSandcrawler extracts (container_title, doc).
+func MapperContainerNameSandcrawler(p []byte) (fields [][]byte, err error) {
+ if fields, err = MapperContainerName(p); err != nil {
return nil, err
}
key := string(fields[0])