Skip to content

Commit fa12a79

Browse files
authored
Merge pull request #89 from djsauble/patch-2
Tidy up comments and indentation in CreateCollection.java
2 parents b7970e2 + 16e1a21 commit fa12a79

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

astra-db-client/src/test/java/com/dtsx/astra/sdk/documentation/CreateCollection.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,29 @@
88

99
public class CreateCollection {
1010
public static void main(String[] args) {
11-
// Given an active db
1211
AstraDB db = new AstraDB("<token>", "<api_endpoint>");
1312

14-
/*
15-
* Create collection with no vector.
16-
*/
13+
// Create a non-vector collection
1714
AstraDBCollection collection1 = db.createCollection("collection_simple");
1815

19-
// Create collection with vector
16+
// Create a vector collection
2017
AstraDBCollection collection2 = db.createCollection(
21-
"collection_vector1",
22-
14,
23-
SimilarityMetric.cosine);
18+
"collection_vector1",
19+
14,
20+
SimilarityMetric.cosine);
2421

25-
// Create collection with vector (builder)
22+
// Create a vector collection with a builder
2623
AstraDBCollection collection3 = db.createCollection(CollectionDefinition
27-
.builder()
28-
.name("collection_vector2")
29-
.vector(1536, SimilarityMetric.euclidean)
30-
.build());
24+
.builder()
25+
.name("collection_vector2")
26+
.vector(1536, SimilarityMetric.euclidean)
27+
.build());
3128

32-
/*
33-
* Collection name should follow [a-zA-Z][a-zA-Z0-9_]* pattern (snake case)
34-
*/
29+
// Collection names should use snake case ([a-zA-Z][a-zA-Z0-9_]*)
3530
try {
3631
db.createCollection("invalid.name");
3732
} catch(JsonApiException e) {
38-
// will fail
33+
// invalid.name is not valid
3934
}
4035
}
4136
}

0 commit comments

Comments
 (0)