diff options
Diffstat (limited to 'skate/cluster.go')
-rw-r--r-- | skate/cluster.go | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/skate/cluster.go b/skate/cluster.go index 3421a0b..7fc4e1b 100644 --- a/skate/cluster.go +++ b/skate/cluster.go @@ -1,7 +1,6 @@ package skate import ( - "fmt" "regexp" "strings" @@ -110,30 +109,6 @@ func KeyTitleSandcrawler(p []byte) (ident string, key string, err error) { return ident, sandcrawlerSlugify(key), nil } -// CreateFixedFieldFunc creates an extractor function given a json path. -// Currently only top level key is supported. -func CreateFixedFieldFunc(path string) IdentifierKeyFunc { - f := func(p []byte) (ident string, key string, err error) { - var doc map[string]interface{} - if err = json.Unmarshal(p, &doc); err != nil { - return - } - v, ok := doc[path] - if !ok { - return "", "", nil - } - switch t := v.(type) { - case string: - return "", t, nil - case int, int64, float32, float64: - return "", fmt.Sprintf("%v", t), nil - default: - return "", "", nil - } - } - return f -} - // sandcrawlerSlugify normalizes a string. func sandcrawlerSlugify(s string) string { slug := strings.ToLower(strings.TrimSpace(s)) |