@@ -99,7 +99,7 @@ public void retrieve() throws ExecutionException, InterruptedException {
9999 assertEquals (1 , points .size ());
100100 RetrievedPoint point = points .get (0 );
101101 assertEquals (id (9 ), point .getId ());
102- assertEquals (ImmutableSet .of ("foo" , "bar" ), point .getPayloadMap ().keySet ());
102+ assertEquals (ImmutableSet .of ("foo" , "bar" , "date" ), point .getPayloadMap ().keySet ());
103103 assertEquals (value ("goodbye" ), point .getPayloadMap ().get ("foo" ));
104104 assertEquals (value (2 ), point .getPayloadMap ().get ("bar" ));
105105 assertEquals (Vectors .getDefaultInstance (), point .getVectors ());
@@ -141,7 +141,7 @@ public void setPayload() throws ExecutionException, InterruptedException {
141141 assertEquals (1 , points .size ());
142142 RetrievedPoint point = points .get (0 );
143143 assertEquals (id (9 ), point .getId ());
144- assertEquals (ImmutableSet .of ("foo" , "bar" ), point .getPayloadMap ().keySet ());
144+ assertEquals (ImmutableSet .of ("foo" , "bar" , "date" ), point .getPayloadMap ().keySet ());
145145 assertEquals (value ("some bar" ), point .getPayloadMap ().get ("bar" ));
146146 assertEquals (value ("goodbye" ), point .getPayloadMap ().get ("foo" ));
147147 }
@@ -188,7 +188,7 @@ public void deletePayload() throws ExecutionException, InterruptedException {
188188 assertEquals (1 , points .size ());
189189 RetrievedPoint point = points .get (0 );
190190 assertEquals (id (9 ), point .getId ());
191- assertEquals (ImmutableSet .of ("bar" ), point .getPayloadMap ().keySet ());
191+ assertEquals (ImmutableSet .of ("bar" , "date" ), point .getPayloadMap ().keySet ());
192192 assertEquals (value ("some bar" ), point .getPayloadMap ().get ("bar" ));
193193 }
194194
@@ -239,6 +239,26 @@ public void createFieldIndex() throws ExecutionException, InterruptedException {
239239 assertEquals (PayloadSchemaType .Integer , collectionInfo .getPayloadSchemaMap ().get ("bar" ).getDataType ());
240240 }
241241
242+ @ Test
243+ public void createDatetimeFieldIndex () throws ExecutionException , InterruptedException {
244+ createAndSeedCollection (testName );
245+
246+ UpdateResult result = client .createPayloadIndexAsync (
247+ testName ,
248+ "date" ,
249+ PayloadSchemaType .Datetime ,
250+ null ,
251+ null ,
252+ null ,
253+ null ).get ();
254+
255+ assertEquals (UpdateStatus .Completed , result .getStatus ());
256+
257+ CollectionInfo collectionInfo = client .getCollectionInfoAsync (testName ).get ();
258+ assertEquals (ImmutableSet .of ("date" ), collectionInfo .getPayloadSchemaMap ().keySet ());
259+ assertEquals (PayloadSchemaType .Datetime , collectionInfo .getPayloadSchemaMap ().get ("date" ).getDataType ());
260+ }
261+
242262 @ Test
243263 public void deleteFieldIndex () throws ExecutionException , InterruptedException {
244264 createAndSeedCollection (testName );
@@ -277,7 +297,7 @@ public void search() throws ExecutionException, InterruptedException {
277297 assertEquals (1 , points .size ());
278298 ScoredPoint point = points .get (0 );
279299 assertEquals (id (9 ), point .getId ());
280- assertEquals (ImmutableSet .of ("foo" , "bar" ), point .getPayloadMap ().keySet ());
300+ assertEquals (ImmutableSet .of ("foo" , "bar" , "date" ), point .getPayloadMap ().keySet ());
281301 assertEquals (value ("goodbye" ), point .getPayloadMap ().get ("foo" ));
282302 assertEquals (value (2 ), point .getPayloadMap ().get ("bar" ));
283303 assertFalse (point .getVectors ().hasVector ());
@@ -589,15 +609,17 @@ private void createAndSeedCollection(String collectionName) throws ExecutionExce
589609 .setVectors (VectorsFactory .vectors (ImmutableList .of (3.5f , 4.5f )))
590610 .putAllPayload (ImmutableMap .of (
591611 "foo" , value ("hello" ),
592- "bar" , value (1 )
612+ "bar" , value (1 ),
613+ "date" , value ("2021-01-01T00:00:00Z" )
593614 ))
594615 .build (),
595616 PointStruct .newBuilder ()
596617 .setId (id (9 ))
597618 .setVectors (VectorsFactory .vectors (ImmutableList .of (10.5f , 11.5f )))
598619 .putAllPayload (ImmutableMap .of (
599620 "foo" , value ("goodbye" ),
600- "bar" , value (2 )
621+ "bar" , value (2 ),
622+ "date" , value ("2024-01-02T00:00:00Z" )
601623 ))
602624 .build ()
603625 )).get ();
0 commit comments