File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed
astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -11,31 +11,27 @@ public static void main(String[] args) {
1111 // Given an active db
1212 AstraDB db = new AstraDB ("<token>" , "<api_endpoint>" );
1313
14- /*
15- * Create collection with no vector.
16- */
14+ // Create a non-vector collection
1715 AstraDBCollection collection1 = db .createCollection ("collection_simple" );
1816
19- // Create collection with vector
17+ // Create a vector collection
2018 AstraDBCollection collection2 = db .createCollection (
21- "collection_vector1" ,
22- 14 ,
23- SimilarityMetric .cosine );
19+ "collection_vector1" ,
20+ 14 ,
21+ SimilarityMetric .cosine );
2422
25- // Create collection with vector ( builder)
23+ // Create a vector collection with a builder
2624 AstraDBCollection collection3 = db .createCollection (CollectionDefinition
27- .builder ()
28- .name ("collection_vector2" )
29- .vector (1536 , SimilarityMetric .euclidean )
30- .build ());
25+ .builder ()
26+ .name ("collection_vector2" )
27+ .vector (1536 , SimilarityMetric .euclidean )
28+ .build ());
3129
32- /*
33- * Collection name should follow [a-zA-Z][a-zA-Z0-9_]* pattern (snake case)
34- */
30+ // Collection names should use snake case ([a-zA-Z][a-zA-Z0-9_]*)
3531 try {
3632 db .createCollection ("invalid.name" );
3733 } catch (JsonApiException e ) {
38- // will fail
34+ // invalid.name is not valid
3935 }
4036 }
4137}
You can’t perform that action at this time.
0 commit comments