Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/docs/targets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,3 @@ You can find end-to-end examples fitting into any of supported property graphs i
* <ExampleButton href="https://github.com/cocoindex-io/cocoindex/tree/main/examples/docs_to_knowledge_graph" text="Docs to Knowledge Graph" margin="0 0 16px 0" />

* <ExampleButton href="https://github.com/cocoindex-io/cocoindex/tree/main/examples/product_recommendation" text="Product Recommendation" margin="0 0 16px 0" />



4 changes: 2 additions & 2 deletions docs/docs/targets/kuzu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
/>
/>
4 changes: 2 additions & 2 deletions docs/docs/targets/neo4j.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
/>
/>
11 changes: 6 additions & 5 deletions docs/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unnecessary.

'targets/postgres',
'targets/qdrant',
'targets/lancedb',
'targets/neo4j',
'targets/kuzu',
],
},
{
Expand Down
40 changes: 38 additions & 2 deletions src/ops/targets/qdrant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ struct VectorDef {
metric: spec::VectorSimilarityMetric,
#[serde(default, skip_serializing_if = "Option::is_none")]
multi_vector_comparator: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
method: Option<spec::VectorIndexMethod>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct SetupState {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 { .. } => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's raise an error here for unsupported index type (IvfFlat), as build() happens earlier.

vector_def_entry.method = Some(method.clone());
}
_ => {
api_bail!("Vector index method is not supported for Qdrant");
}
}
}
}
None => {
Expand Down
Loading