MCPcopy
hub / github.com/dgraph-io/dgraph / QueryMultipleVectorsUsingSimilarTo

Method QueryMultipleVectorsUsingSimilarTo

dgraphapi/vector.go:44–59  ·  view source on GitHub ↗
(vector []float32, pred string, topK int)

Source from the content-addressed store, hash-verified

42}
43
44func (gc *GrpcClient) QueryMultipleVectorsUsingSimilarTo(vector []float32, pred string, topK int) ([][]float32, error) {
45 vectorQuery := fmt.Sprintf(`
46 {
47 vector(func: similar_to(%v, %v, "%v")) {
48 uid
49 %v
50 }
51 }`, pred, topK, vector, pred)
52 resp, err := gc.Query(vectorQuery)
53
54 if err != nil {
55 return [][]float32{}, err
56 }
57
58 return UnmarshalVectorResp(resp)
59}
60
61func (gc *GrpcClient) QuerySingleVectorsUsingUid(uid, pred string) ([][]float32, error) {
62 vectorQuery := fmt.Sprintf(`

Calls 2

QueryMethod · 0.95
UnmarshalVectorRespFunction · 0.85