Skip to content

Commit d237151

Browse files
committed
Addressed comments
1 parent 61ec83a commit d237151

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/VectorIndexTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,22 +341,22 @@ private List<CosmosVectorIndexSpec> populateVectorIndexes() {
341341
CosmosVectorIndexSpec cosmosVectorIndexSpec2 = new CosmosVectorIndexSpec()
342342
.setPath("/vector2")
343343
.setType(CosmosVectorIndexType.QUANTIZED_FLAT.toString())
344-
.setQuantizerType(QuantizerType.product)
344+
.setQuantizerType(QuantizerType.PRODUCT)
345345
.setQuantizationSizeInBytes(2)
346346
.setVectorIndexShardKeys(Arrays.asList("/zipCode"));
347347

348348
CosmosVectorIndexSpec cosmosVectorIndexSpec3 = new CosmosVectorIndexSpec()
349349
.setPath("/vector3")
350350
.setType(CosmosVectorIndexType.DISK_ANN.toString())
351-
.setQuantizerType(QuantizerType.product)
351+
.setQuantizerType(QuantizerType.PRODUCT)
352352
.setQuantizationSizeInBytes(2)
353353
.setIndexingSearchListSize(30)
354354
.setVectorIndexShardKeys(Arrays.asList("/country/city"));
355355

356356
CosmosVectorIndexSpec cosmosVectorIndexSpec4 = new CosmosVectorIndexSpec()
357357
.setPath("/vector4")
358358
.setType(CosmosVectorIndexType.DISK_ANN.toString())
359-
.setQuantizerType(QuantizerType.spherical)
359+
.setQuantizerType(QuantizerType.SPHERICAL)
360360
.setIndexingSearchListSize(30)
361361
.setVectorIndexShardKeys(Arrays.asList("/country/city"));
362362

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Constants.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
package com.azure.cosmos.implementation;
55

6-
import java.util.List;
76

87
/**
98
* Used internally. Constants in the Azure Cosmos DB database service Java SDK.
@@ -121,7 +120,7 @@ public static final class Properties {
121120
public static final String ORDER = "order";
122121
public static final String SPATIAL_INDEXES = "spatialIndexes";
123122
public static final String TYPES = "types";
124-
public static final String QUANTIZER_TYPE = "QuantizerType";
123+
public static final String QUANTIZER_TYPE = "quantizerType";
125124

126125
// Full text search
127126
public static final String FULL_TEXT_INDEXES = "fullTextIndexes";

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosVectorIndexSpec.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public CosmosVectorIndexSpec setType(String type) {
8787
}
8888

8989
/**
90-
* Gets quantizer type.
90+
* Gets the quantizer type.
9191
*
9292
* @return the quantizer type.
9393
*/
@@ -99,17 +99,18 @@ public QuantizerType getQuantizerType() {
9999
}
100100

101101
/**
102-
* Set quantizer type.
102+
* Set the quantizer type.
103103
*
104104
* @param quantizerType The quantizer type
105-
* @return the SpatialSpec.
105+
* @return the CosmosVectorIndexSpec.
106106
*/
107107
public CosmosVectorIndexSpec setQuantizerType(QuantizerType quantizerType) {
108108
if (validateIndexType(IndexProperty.QUANTIZER_TYPE) && quantizerType != null) {
109109
this.quantizerType = quantizerType;
110110
this.jsonSerializable.set(Constants.Properties.QUANTIZER_TYPE, quantizerType);
111111
} else {
112112
this.quantizerType = null;
113+
this.jsonSerializable.remove(Constants.Properties.QUANTIZER_TYPE);
113114
}
114115
return this;
115116
}

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/QuantizerType.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33

44
package com.azure.cosmos.models;
55

6+
import com.fasterxml.jackson.annotation.JsonValue;
7+
68
/**
7-
* Defines the quantizer type of vector index path specification in the Azure Cosmos DB service.
9+
* Defines quantizer types for vector index specifications in the Azure Cosmos DB service.
810
*/
911
public enum QuantizerType {
1012
/**
11-
* Represent a product quantizer type.
13+
* Represents a product quantizer type.
1214
*/
13-
product("product"),
15+
PRODUCT("product"),
1416

1517
/**
16-
* Represent a spherical quantizer type.
18+
* Represents a spherical quantizer type.
1719
*/
18-
spherical("spherical");
20+
SPHERICAL("spherical");
1921

2022

2123
QuantizerType(String overWireValue) {
@@ -24,6 +26,7 @@ public enum QuantizerType {
2426

2527
private final String overWireValue;
2628

29+
@JsonValue
2730
@Override
2831
public String toString() {
2932
return this.overWireValue;

0 commit comments

Comments
 (0)