diff --git a/docs/docs/targets/index.md b/docs/docs/targets/index.md index 36d117b7..73771e2a 100644 --- a/docs/docs/targets/index.md +++ b/docs/docs/targets/index.md @@ -335,6 +335,3 @@ You can find end-to-end examples fitting into any of supported property graphs i * * - - - diff --git a/docs/docs/targets/kuzu.md b/docs/docs/targets/kuzu.md index ae129ef3..6e8f1ccf 100644 --- a/docs/docs/targets/kuzu.md +++ b/docs/docs/targets/kuzu.md @@ -11,7 +11,7 @@ Exports data to a [Kuzu](https://kuzu.com/) graph database. ## Get Started -Read [Property Graph Targets](./index.md#property-graph-targets) for more information to get started on how it works in CocoIndex. +Read [Property Graph Targets](./index.md#property-graph-targets) for more information to get started on how it works in CocoIndex. ## Spec @@ -57,4 +57,4 @@ You can then access the explorer at [http://localhost:8124](http://localhost:812 href="https://github.com/cocoindex-io/cocoindex/tree/main/examples/docs_to_knowledge_graph" text="Docs to Knowledge Graph" margin="16px 0 24px 0" -/> \ No newline at end of file +/> diff --git a/docs/docs/targets/neo4j.md b/docs/docs/targets/neo4j.md index 513d7066..3baf7e34 100644 --- a/docs/docs/targets/neo4j.md +++ b/docs/docs/targets/neo4j.md @@ -11,7 +11,7 @@ import { ExampleButton } from '../../src/components/GitHubButton'; ## Get Started -Read [Property Graph Targets](./index.md#property-graph-targets) for more information to get started on how it works in CocoIndex. +Read [Property Graph Targets](./index.md#property-graph-targets) for more information to get started on how it works in CocoIndex. ## Spec @@ -49,4 +49,4 @@ You can access the Neo4j browser at [http://localhost:7474](http://localhost:747 href="https://github.com/cocoindex-io/cocoindex/tree/main/examples/docs_to_knowledge_graph" text="Docs to Knowledge Graph" margin="16px 0 24px 0" -/> \ No newline at end of file +/> diff --git a/docs/sidebars.ts b/docs/sidebars.ts index 9910418a..27ede867 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -53,11 +53,12 @@ const sidebars: SidebarsConfig = { link: { type: 'doc', id: 'targets/index' }, collapsed: true, items: [ - 'targets/postgres', - 'targets/qdrant', - 'targets/lancedb', - 'targets/neo4j', - 'targets/kuzu', + + 'targets/postgres', + 'targets/qdrant', + 'targets/lancedb', + 'targets/neo4j', + 'targets/kuzu', ], }, { diff --git a/src/ops/targets/qdrant.rs b/src/ops/targets/qdrant.rs index cdb0e2f4..8ee1f73a 100644 --- a/src/ops/targets/qdrant.rs +++ b/src/ops/targets/qdrant.rs @@ -139,6 +139,8 @@ struct VectorDef { metric: spec::VectorSimilarityMetric, #[serde(default, skip_serializing_if = "Option::is_none")] multi_vector_comparator: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + method: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] struct SetupState { @@ -221,6 +223,25 @@ impl SetupChange { vector_def.vector_size as u64, embedding_metric_to_qdrant(vector_def.metric)?, ); + if let Some(method) = &vector_def.method { + match method { + spec::VectorIndexMethod::Hnsw { m, ef_construction } => { + if let Some(m_val) = m { + params = params.hnsw_m(*m_val as u64); + } + if let Some(ef_val) = ef_construction { + params = params.hnsw_ef_construct(*ef_val as u64); + } + } + spec::VectorIndexMethod::IvfFlat => { + api_bail!("IvfFlat vector index method is not supported for Qdrant yet"); + } + + _ => { + api_bail!("Unsupported vector index method for Qdrant"); + } + } + } if let Some(multi_vector_comparator) = &vector_def.multi_vector_comparator { params = params.multivector_config(MultiVectorConfigBuilder::new( MultiVectorComparator::from_str_name(multi_vector_comparator) @@ -422,8 +443,23 @@ impl TargetFactoryBase for Factory { } else { api_bail!("Field `{}` specified more than once in vector index definition", vector_index.field_name); } - if vector_index.method.is_some() { - api_bail!("Vector index method is not configurable for Qdrant yet"); + + let vector_def_entry = vector_def.get_mut(&vector_index.field_name) + .expect("VectorDef must exist here"); + + vector_def_entry.vector_size = vector_index.vector_size; + vector_def_entry.metric = vector_index.metric.clone(); + + if let Some(method) = &vector_index.method { + match method { + spec::VectorIndexMethod::Hnsw { .. } | + spec::VectorIndexMethod::IvfFlat { .. } => { + vector_def_entry.method = Some(method.clone()); + } + _ => { + api_bail!("Vector index method is not supported for Qdrant"); + } + } } } None => {