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