Skip to content

Commit 61ec83a

Browse files
committed
Added QUANTIZER_TYPE TO IndexProperty
1 parent 798c1b6 commit 61ec83a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/IndexProperty.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
public enum IndexProperty {
66
INDEXING_SEARCH_LIST_SIZE,
77
QUANTIZATION_SIZE_IN_BYTES,
8-
VECTOR_INDEX_SHARD_KEYS;
8+
VECTOR_INDEX_SHARD_KEYS,
9+
QUANTIZER_TYPE,
910
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public QuantizerType getQuantizerType() {
105105
* @return the SpatialSpec.
106106
*/
107107
public CosmosVectorIndexSpec setQuantizerType(QuantizerType quantizerType) {
108-
if (quantizerType != null) {
108+
if (validateIndexType(IndexProperty.QUANTIZER_TYPE) && quantizerType != null) {
109109
this.quantizerType = quantizerType;
110110
this.jsonSerializable.set(Constants.Properties.QUANTIZER_TYPE, quantizerType);
111111
} else {
@@ -223,7 +223,9 @@ JsonSerializable getJsonSerializable() {
223223

224224
private Boolean validateIndexType(IndexProperty indexProperty) {
225225
String vectorIndexType = this.jsonSerializable.getString(Constants.Properties.VECTOR_INDEX_TYPE);
226-
if (indexProperty.equals(IndexProperty.QUANTIZATION_SIZE_IN_BYTES) || (indexProperty.equals(IndexProperty.VECTOR_INDEX_SHARD_KEYS))) {
226+
if (indexProperty.equals(IndexProperty.QUANTIZATION_SIZE_IN_BYTES) ||
227+
(indexProperty.equals(IndexProperty.VECTOR_INDEX_SHARD_KEYS)) ||
228+
(indexProperty.equals(IndexProperty.QUANTIZER_TYPE))) {
227229
return vectorIndexType.equals(CosmosVectorIndexType.QUANTIZED_FLAT.toString()) ||
228230
vectorIndexType.equals(CosmosVectorIndexType.DISK_ANN.toString());
229231
}

0 commit comments

Comments
 (0)