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

Function TestVectorMutationWithoutIndex

query/vector/vector_test.go:621–659  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

619}
620
621func TestVectorMutationWithoutIndex(t *testing.T) {
622 dropPredicate("vtest")
623
624 pred := "vtest"
625 setSchema(fmt.Sprintf(vectorSchemaWithoutIndex, pred))
626
627 numVectors := 1000
628 vectorSize := 4
629
630 randomVectors, _ := generateRandomVectors(numVectors, vectorSize, pred)
631 require.NoError(t, addTriplesToCluster(randomVectors))
632
633 query := `{
634 vector(func: has(vtest)) {
635 count(uid)
636 }
637 }`
638
639 result := processQueryNoErr(t, query)
640 require.JSONEq(t, fmt.Sprintf(`{"data": {"vector":[{"count":%d}]}}`, numVectors), result)
641
642 dropPredicate("vtest")
643
644 pred = "vtest2"
645 setSchema(fmt.Sprintf(vectorSchemaWithoutIndex, pred))
646
647 randomVectors, _ = generateRandomVectors(numVectors, vectorSize, pred)
648 require.NoError(t, addTriplesToCluster(randomVectors))
649
650 query = `{
651 vector(func: has(vtest2)) {
652 count(uid)
653 }
654 }`
655
656 result = processQueryNoErr(t, query)
657 require.JSONEq(t, fmt.Sprintf(`{"data": {"vector":[{"count":%d}]}}`, numVectors), result)
658 dropPredicate("vtest2")
659}
660
661func TestVectorDelete(t *testing.T) {
662 pred := "vtest"

Callers

nothing calls this directly

Calls 5

generateRandomVectorsFunction · 0.85
dropPredicateFunction · 0.70
setSchemaFunction · 0.70
addTriplesToClusterFunction · 0.70
processQueryNoErrFunction · 0.70

Tested by

no test coverage detected