@@ -34,17 +34,25 @@ public function setUp(): void
3434 'range ' => true ,
3535 'lookup ' => false ,
3636 'is_principal ' => true
37- ]))
37+ ])),
38+ [
39+ 'wait ' => 'true '
40+ ]
3841 );
3942
4043 $ this ->assertEquals ('ok ' , $ response ['status ' ]);
41- $ this ->assertEquals ('acknowledged ' , $ response ['result ' ]['status ' ]);
44+ $ this ->assertEquals ('completed ' , $ response ['result ' ]['status ' ]);
4245
4346 $ response = $ this ->getCollections ('sample-collection ' )->points ()
44- ->upsert (PointsStruct::createFromArray (self ::basicPointDataProvider ()[0 ][0 ]));
47+ ->upsert (
48+ PointsStruct::createFromArray (self ::basicPointDataProvider ()[0 ][0 ]),
49+ [
50+ 'wait ' => 'true '
51+ ]
52+ );
4553
4654 $ this ->assertEquals ('ok ' , $ response ['status ' ]);
47- $ this ->assertEquals ('acknowledged ' , $ response ['result ' ]['status ' ]);
55+ $ this ->assertEquals ('completed ' , $ response ['result ' ]['status ' ]);
4856 }
4957
5058 public static function basicPointDataProvider (): array
@@ -65,23 +73,23 @@ public static function basicPointDataProvider(): array
6573 'vector ' => new VectorStruct ([1 , 3 , 300 ], 'image ' ),
6674 'payload ' => [
6775 'sort ' => 2 ,
68- 'image ' => 'red '
76+ 'color ' => 'red '
6977 ]
7078 ],
7179 [
7280 'id ' => 3 ,
7381 'vector ' => new VectorStruct ([1 , 3 , 300 ], 'image ' ),
7482 'payload ' => [
7583 'sort ' => 3 ,
76- 'image ' => 'green '
84+ 'color ' => 'green '
7785 ]
7886 ],
7987 ]
8088 ]
8189 ];
8290 }
8391
84- public function testSearchPoint (): void
92+ public function testScrollAscPoint (): void
8593 {
8694 $ filter = (new Filter ())->addMust (
8795 new MatchString ('color ' , 'red ' )
@@ -92,8 +100,25 @@ public function testSearchPoint(): void
92100
93101 $ this ->assertEquals ('ok ' , $ response ['status ' ]);
94102 $ this ->assertCount (2 , $ response ['result ' ]);
103+ $ this ->assertEquals (1 , $ response ['result ' ]['points ' ][0 ]['id ' ]);
95104 }
96105
106+ public function testScrollDescPoint (): void
107+ {
108+ $ filter = (new Filter ())->addMust (
109+ new MatchString ('color ' , 'red ' )
110+ );
111+
112+ $ scroll = (new ScrollRequest ())->setFilter ($ filter )->setOrderBy ([
113+ 'key ' => 'sort ' ,
114+ 'direction ' => 'desc '
115+ ]);
116+ $ response = $ this ->getCollections ('sample-collection ' )->points ()->scroll ($ scroll );
117+
118+ $ this ->assertEquals ('ok ' , $ response ['status ' ]);
119+ $ this ->assertCount (2 , $ response ['result ' ]);
120+ $ this ->assertEquals (2 , $ response ['result ' ]['points ' ][0 ]['id ' ]);
121+ }
97122
98123 protected function tearDown (): void
99124 {
0 commit comments