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

Function TestVectorUpdate

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

Source from the content-addressed store, hash-verified

715}
716
717func TestVectorUpdate(t *testing.T) {
718 pred := "vtest"
719 dropPredicate(pred)
720
721 setSchema(fmt.Sprintf(vectorSchemaWithIndex, pred, "4", "euclidean"))
722
723 numVectors := 1000
724 rdf, vectors := generateRandomVectors(1000, 10, "vtest")
725 require.NoError(t, addTriplesToCluster(rdf))
726
727 allVectors, err := queryAllVectorsPred(t, "vtest")
728 require.NoError(t, err)
729
730 require.Equal(t, vectors, allVectors)
731
732 updateVectorQuery := func(idx int) {
733 triple := strings.Split(rdf, "\n")[idx]
734 updatedVec := updateVector(t, triple, "vtest")
735 allVectors[idx] = updatedVec
736
737 updatedVectors, err := queryMultipleVectorsUsingSimilarTo(t, allVectors[0], "vtest", 100)
738 require.NoError(t, err)
739
740 for _, i := range updatedVectors {
741 require.Contains(t, allVectors, i)
742 }
743 }
744
745 for i := 0; i < 1000; i++ {
746 idx := rand.Intn(numVectors)
747 updateVectorQuery(idx)
748 }
749}
750
751func TestVectorWithoutQuote(t *testing.T) {
752 pred := "test-ve"

Callers

nothing calls this directly

Calls 7

generateRandomVectorsFunction · 0.85
queryAllVectorsPredFunction · 0.85
updateVectorFunction · 0.85
dropPredicateFunction · 0.70
setSchemaFunction · 0.70
addTriplesToClusterFunction · 0.70

Tested by

no test coverage detected