diff options
-rw-r--r-- | skate/map.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/skate/map.go b/skate/map.go index 7000f6a..f401af7 100644 --- a/skate/map.go +++ b/skate/map.go @@ -121,8 +121,13 @@ func Identity(p []byte) ([][]byte, error) { } // CreateFixedMapper extract the value from a given fixed json key, e.g. -// ".biblio.doi" and the like. Returns a function that maps doc to (value, doc). +// "biblio.doi" and the like. Returns a function that maps doc to (value, doc). func CreateFixedMapper(field string) Mapper { + if len(field) > 0 && field[0] == "." { + // gjson is not jq, we do not use a leading dot, so remove it, if + // accidentally used here + field = field[1:] + } f := func(p []byte) ([][]byte, error) { result := gjson.GetBytes(p, field) key := []byte(result.String()) |