diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-07-27 13:19:07 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-07-27 13:19:07 +0200 |
commit | 1756a09a3b5ed99d7fda27ce32632a0feb7fdc85 (patch) | |
tree | 41def30290a0e09fb1f2878a8253fde9ebacab4f | |
parent | 9a07523ddb1b1afae67cf52e5ca264b755a8e494 (diff) | |
download | refcat-1756a09a3b5ed99d7fda27ce32632a0feb7fdc85.tar.gz refcat-1756a09a3b5ed99d7fda27ce32632a0feb7fdc85.zip |
remove unused/partially implemented skate-dot for now
-rw-r--r-- | skate/Makefile | 2 | ||||
-rw-r--r-- | skate/cmd/skate-dot/main.go | 74 |
2 files changed, 1 insertions, 75 deletions
diff --git a/skate/Makefile b/skate/Makefile index 8092cbe..4df05f8 100644 --- a/skate/Makefile +++ b/skate/Makefile @@ -1,5 +1,5 @@ SHELL := /bin/bash -TARGETS := skate-conv skate-cleanup skate-from-unstructured skate-wikipedia-doi skate-dot skate-map skate-reduce skate-cdx-lookup skate-resolve-journal-name +TARGETS := skate-conv skate-cleanup skate-from-unstructured skate-wikipedia-doi skate-map skate-reduce skate-cdx-lookup skate-resolve-journal-name PKGNAME := skate .PHONY: test diff --git a/skate/cmd/skate-dot/main.go b/skate/cmd/skate-dot/main.go deleted file mode 100644 index 573209e..0000000 --- a/skate/cmd/skate-dot/main.go +++ /dev/null @@ -1,74 +0,0 @@ -// [wip] skate-dot generates dot files from inbound and outbound citation -// links. Just a demo, replacement for a couple python scripts. We want things -// like: https://git.io/JObzq. -package main - -import ( - "context" - "flag" - "fmt" - "io" - "log" - "os" - - "github.com/elastic/go-elasticsearch/esapi" - elasticsearch "github.com/elastic/go-elasticsearch/v7" -) - -var ( - es = flag.String("es", "http://localhost:9200", "elasticsearch holding fatcat_ref index") - index = flag.String("x", "fatcat_ref_v01", "index name") - fatcat = flag.String("f", "https://api.fatcat.wiki/v0", "fatcat api") - ident = flag.String("i", "2kw3xjf2cbcmdlm3ihkoz2t4lu", "release ident") -) - -func main() { - flag.Parse() - cfg := elasticsearch.Config{Addresses: []string{*es}} - es, err := elasticsearch.NewClient(cfg) - if err != nil { - log.Fatal(err) - } - client := &Client{ - Api: *fatcat, - Es: es, - Index: *index, - } - client.Outbound(*ident) -} - -// A client for fatcat and elasticsearch. -type Client struct { - Api string - Es *elasticsearch.Client - Index string -} - -func (c *Client) String() string { - info, _ := c.Es.Info() - return fmt.Sprintf("%s %s (%s) %s", c.Api, info, elasticsearch.Version, c.Index) -} - -func (c *Client) Inbound(ident string) []string { - resp, err := c.Es.Search( - c.Es.Search.WithContext(context.Background()), - c.Es.Search.WithIndex(c.Index), - ) - if err != nil { - log.Fatal(err) - } - io.Copy(os.Stdout, resp.Body) - return nil -} - -func (c *Client) Outbound(ident string) []string { - req := &esapi.SearchRequest{ - Query: fmt.Sprintf("source_release_ident:%s", ident), - } - resp, err := req.Do(context.Background(), c.Es) - if err != nil { - log.Fatal(err) - } - io.Copy(os.Stdout, resp.Body) - return nil -} |