save
This commit is contained in:
parent
e533c2c335
commit
ba0b011ce4
|
@ -134,7 +134,11 @@ func (m *Matcher) Run(wg *sync.WaitGroup, graphClient *dgo.Dgraph) {
|
||||||
q := `query allofterms($a: string) {
|
q := `query allofterms($a: string) {
|
||||||
Node(func: allofterms(full, $a)) {
|
Node(func: allofterms(full, $a)) {
|
||||||
uid
|
uid
|
||||||
}}`
|
type
|
||||||
|
full
|
||||||
|
}
|
||||||
|
|
||||||
|
}`
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
txn := graphClient.NewTxn()
|
txn := graphClient.NewTxn()
|
||||||
|
@ -157,6 +161,7 @@ func (m *Matcher) Run(wg *sync.WaitGroup, graphClient *dgo.Dgraph) {
|
||||||
Type: "matcher",
|
Type: "matcher",
|
||||||
}
|
}
|
||||||
if len(n.Result) != 0 {
|
if len(n.Result) != 0 {
|
||||||
|
fmt.Println("first query res", res)
|
||||||
// TODO: review time and id to be updated on new resulsts
|
// TODO: review time and id to be updated on new resulsts
|
||||||
|
|
||||||
for _, res := range n.Result {
|
for _, res := range n.Result {
|
||||||
|
@ -173,19 +178,10 @@ func (m *Matcher) Run(wg *sync.WaitGroup, graphClient *dgo.Dgraph) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// query := fmt.Sprintf(`
|
query := `query { match as var(func: eq(target, "code")) } `
|
||||||
// query {
|
|
||||||
// (func: eq(id, "%s")) {
|
|
||||||
// uid
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// `, matcher.ID)
|
|
||||||
|
|
||||||
query := `query { match as var(func: eq(target, "java")) } `
|
|
||||||
|
|
||||||
// nquads := fmt.Sprintf(`uid(match) <nodes> "%v" .`, matcher.Nodes)
|
|
||||||
fmt.Println("nodes", matcher.Nodes)
|
fmt.Println("nodes", matcher.Nodes)
|
||||||
pb, err := json.Marshal(models.Match{UID: "uid(match)", Target: "java", Nodes: matcher.Nodes})
|
pb, err := json.Marshal(models.Match{UID: "uid(match)", Target: "code", Nodes: matcher.Nodes, Type: "matcher"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -200,8 +196,8 @@ func (m *Matcher) Run(wg *sync.WaitGroup, graphClient *dgo.Dgraph) {
|
||||||
CommitNow: true,
|
CommitNow: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("requests", req)
|
ret, err := graphClient.NewTxn().Do(ctx, req)
|
||||||
_, err = graphClient.NewTxn().Do(ctx, req)
|
fmt.Println(ret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue