From f57691a229ff10adada6f6a59c47c6574f284825 Mon Sep 17 00:00:00 2001 From: Asier Isayas Date: Mon, 7 Apr 2025 11:12:34 -0400 Subject: [PATCH] Add vector index shard key --- src/Contracts/DataModels.ts | 2 +- .../VectorEmbeddingPoliciesComponent.tsx | 48 +++++++------------ 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts index 3b3ab5027..08d0ac3f8 100644 --- a/src/Contracts/DataModels.ts +++ b/src/Contracts/DataModels.ts @@ -207,7 +207,7 @@ export interface IndexingPolicy { export interface VectorIndex { path: string; type: "flat" | "diskANN" | "quantizedFlat"; - diskANNShardKey?: string; + vectorIndexShardKey?: string[]; indexingSearchListSize?: number; quantizationByteSize?: number; } diff --git a/src/Explorer/Controls/VectorSearch/VectorEmbeddingPoliciesComponent.tsx b/src/Explorer/Controls/VectorSearch/VectorEmbeddingPoliciesComponent.tsx index 03d1ab1e6..b391ce498 100644 --- a/src/Explorer/Controls/VectorSearch/VectorEmbeddingPoliciesComponent.tsx +++ b/src/Explorer/Controls/VectorSearch/VectorEmbeddingPoliciesComponent.tsx @@ -39,8 +39,7 @@ export interface VectorEmbeddingPolicyData { indexType: VectorIndex["type"] | "none"; pathError: string; dimensionsError: string; - diskANNShardKey?: string; - diskANNShardKeyError?: string; + vectorIndexShardKey?: string[]; indexingSearchListSize?: number; indexingSearchListSizeError?: string; quantizationByteSize?: number; @@ -132,12 +131,6 @@ export const VectorEmbeddingPoliciesComponent: FunctionComponent { - // return ""; - // }; - const initializeData = (vectorEmbeddings: VectorEmbedding[], vectorIndexes: VectorIndex[]) => { const mergedData: VectorEmbeddingPolicyData[] = []; vectorEmbeddings.forEach((embedding) => { @@ -147,6 +140,7 @@ export const VectorEmbeddingPoliciesComponent: FunctionComponent) => { - // const value = event.target.value.trim(); - // const vectorEmbeddings = [...vectorEmbeddingPolicyData]; - // if (!vectorEmbeddings[index]?.diskANNShardKey && !value.startsWith("/")) { - // vectorEmbeddings[index].diskANNShardKey = "/" + value; - // } else { - // vectorEmbeddings[index].diskANNShardKey = value; - // } - // const error = onDiskANNShardKeyError(value); - // vectorEmbeddings[index].diskANNShardKeyError = error; - // setVectorEmbeddingPolicyData(vectorEmbeddings); - // } + const onShardKeyChange = (index: number, event: React.ChangeEvent) => { + const value = event.target.value.trim(); + const vectorEmbeddings = [...vectorEmbeddingPolicyData]; + if (!vectorEmbeddings[index]?.vectorIndexShardKey?.[0] && !value.startsWith("/")) { + vectorEmbeddings[index].vectorIndexShardKey = ["/" + value]; + } else { + vectorEmbeddings[index].vectorIndexShardKey = [value]; + } + setVectorEmbeddingPolicyData(vectorEmbeddings); + } const onVectorEmbeddingPolicyChange = ( index: number, @@ -431,26 +422,23 @@ export const VectorEmbeddingPoliciesComponent: FunctionComponent - {/*TODO: uncomment after Ignite */} - {/* DiskANNShardKey was removed for Ignite due to backend problems. Leaving this here as it will be reinstated immediately after Ignite + >Shard key ) => - onDiskANNShardKeyChange(index, event) + onShardKeyChange(index, event) } /> - - */} + )}