Closed its-smesh closed 1 year ago
bindVars := map[string]interface{}{}
you have nothing tied down
bindVars["Key"]= "12345" ...
or
bindVars = map[string]interface{}{
"Lang": mylang,
"Company": "12345",,
"Key": key,
}
You need as example fullcount:
ctx := driver.WithQueryFullCount(ctx := context.Background())
you get the value with cursor.Statistics().FullCount()
bindVars does not contain the query result. As its name suggests, you specify @foo
bind variables by passing in the map to Query.
You need to iterate over cursor.ReadDocument():
defer cursor.Close()
var results []interface{} // Use whatever type you want.
for cursor.HasMore() {
var result interface{}
if _, err := cursor.ReadDocument(ctx, &result); err != nil {
return err
}
results = append(results, result)
}
return results, nil
Environment:
Issue: driver.Database.Query() with bindVars is always empty. Verified same AQL query via ArangoDB, and it's successfully returned 2 documents.
Code Snipper:
` func (s *Service) searchProduct(offset int, count int) (interface{},int64, error){ //FOR doc IN explore SORT BM25(doc) DESC LIMIT 0,10 RETURN doc queryBuilder := query.NewForQuery(exploreViewName, "doc") qs := queryBuilder.SortBM25(true). LIMIT(offset, count). Return().String() s.logFactory.Fields().Done().Info(qs)
} `
This is a blocker, given we can't execute a simple AQL query.