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

Function testVectorQuery

systest/vector/vector_test.go:31–45  ·  view source on GitHub ↗
(t *testing.T, gc *dgraphapi.GrpcClient, vectors [][]float32, rdfs, pred string, topk int)

Source from the content-addressed store, hash-verified

29)
30
31func testVectorQuery(t *testing.T, gc *dgraphapi.GrpcClient, vectors [][]float32, rdfs, pred string, topk int) {
32 for i, vector := range vectors {
33 triple := strings.Split(rdfs, "\n")[i]
34 uid := strings.Split(triple, " ")[0]
35 queriedVector, err := gc.QuerySingleVectorsUsingUid(uid, pred)
36 require.NoError(t, err)
37 require.Equal(t, vectors[i], queriedVector[0])
38
39 similarVectors, err := gc.QueryMultipleVectorsUsingSimilarTo(vector, pred, topk)
40 require.NoError(t, err)
41 for _, similarVector := range similarVectors {
42 require.Contains(t, vectors, similarVector)
43 }
44 }
45}
46
47func TestVectorDropAll(t *testing.T) {
48 conf := dgraphtest.NewClusterConfig().WithNumAlphas(1).WithNumZeros(1).WithReplicas(1).WithACL(time.Hour)

Callers 6

testExportAndLiveLoadFunction · 0.85
TestVectorDropAllFunction · 0.85
TestVectorSnapshotFunction · 0.85
TestVectorBackupRestoreFunction · 0.85

Tested by

no test coverage detected