mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-03 01:48:32 +02:00
Edge 0.7 documentation updates (#2391)
* docs(edge): add "Modify the Vector Schema" step to quickstart Documents the new Edge 0.7 API for adding and removing named vector fields on an existing shard without recreating it, with Python and Rust snippets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(edge): mention quantization support in quickstart Adds a note after the EdgeConfig snippet that Edge supports all four quantization methods (Scalar, Product, Binary, TurboQuant), with a link to the quantization guide. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(edge): add On-Device BM25 page for Edge 0.7 New guide covering the built-in BM25 sparse embedder: configuring a sparse vector shard, creating a Bm25/EdgeBm25 embedder, embedding and upserting documents, and querying. Includes Python and Rust snippets. Also adds the page to the Edge index navigation table. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(edge): add WAL segment size configuration to quickstart Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Upgrade code snippets to Edge 0.7.2 * Review feedback --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
56211977fb
commit
ffe50340fa
@@ -44,6 +44,7 @@ To work with a Qdrant Edge Shard, use the [Python Bindings for Qdrant Edge](http
|
||||
|--------------|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
|
||||
| **Beginner** | [Qdrant Edge Quickstart](/documentation/edge/edge-quickstart/) | Get started with Qdrant Edge and learn the basics of managing and querying data |
|
||||
| **Beginner** | [On-Device Embeddings](/documentation/edge/edge-fastembed-embeddings/) | Generate vector embeddings directly on edge devices using FastEmbed |
|
||||
| **Beginner** | [On-Device BM25](/documentation/edge/edge-bm25/) | Generate BM25 sparse embeddings on-device for keyword search |
|
||||
| **Reference** | [Data Synchronization Patterns](/documentation/edge/edge-data-synchronization-patterns/) | Overview of patterns for synchronizing data between Edge Shards and Qdrant server collections |
|
||||
| **Advanced** | [Synchronize with a Server](/documentation/edge/edge-synchronization-guide/) | Synchronize an Edge Shard with a Qdrant server collection to offload indexing and synchronize data between devices |
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
title: "BM25"
|
||||
short_description: "Generate BM25 sparse embeddings for keyword search with Qdrant Edge, compatible with server-side BM25 collections."
|
||||
description: "Use the built-in BM25 embedder in Qdrant Edge to generate sparse text embeddings on-device for keyword search, without an internet connection or external model server."
|
||||
weight: 16
|
||||
partition: develop
|
||||
---
|
||||
|
||||
# BM25 with Qdrant Edge
|
||||
|
||||
[BM25](/documentation/search/text-search/#bm25) (Best Matching 25) is a popular sparse-vector ranking algorithm for full-text search. Qdrant Edge includes a built-in BM25 embedder, so you can run keyword search without an internet connection or external embedding service.
|
||||
|
||||
The BM25 embedder is compatible with server-side BM25: vectors produced by the Qdrant Edge embedder use the same token IDs and scoring formula as Qdrant Server's [text search](/documentation/search/text-search/#bm25) pipeline. You can initialize an Edge Shard from a server snapshot and query it with locally produced BM25 vectors without re-indexing.
|
||||
|
||||
In Python, use the `Bm25` and `Bm25Config` classes. In Rust, use `EdgeBm25` and `EdgeBm25Config` from the `qdrant_edge::bm25_embed` module.
|
||||
|
||||
## Configure a Sparse Vector
|
||||
|
||||
To get started with BM25, create an Edge Shard with a sparse vector field and `Modifier.Idf`. The IDF modifier enables inverse document frequency weighting, which is required for BM25 scoring:
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/bm25/" block="configure-bm25-shard" >}}
|
||||
|
||||
## Create a BM25 Embedder
|
||||
|
||||
Instantiate a BM25 embedder with a language setting. The embedder applies stemming and stopword filtering for the specified language:
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/bm25/" block="create-bm25" >}}
|
||||
|
||||
`Bm25Config` accepts the following parameters:
|
||||
|
||||
| Parameter | Description |
|
||||
|---|---|
|
||||
| `language` | Language for stemming and stopwords (for example, `"english"`, `"german"`). Defaults to `None`, which falls back to English stemming and stopwords. |
|
||||
| `k` | Term frequency saturation parameter. Default: `1.2`. |
|
||||
| `b` | Document length normalization factor. Default: `0.75`. |
|
||||
| `avg_len` | Expected average document length in tokens. Default: `256`. |
|
||||
| `lowercase` | Convert tokens to lowercase before embedding. Default: `true`. |
|
||||
| `ascii_folding` | Normalize accented characters to ASCII equivalents. Default: `false`. |
|
||||
| `stemmer` | Override the stemming algorithm. |
|
||||
| `stopwords` | Override the stopword list. |
|
||||
| `tokenizer` | Tokenizer used to break down text into individual tokens (words). Can be `"prefix"`, `"whitespace"`, `"word"`, or `"multilingual"`. Default: `"word"`. |
|
||||
| `min_token_len` | Minimum token length to include. |
|
||||
| `max_token_len` | Maximum token length to include. |
|
||||
|
||||
For a full description of each parameter, see [Configuring BM25 Parameters](/documentation/search/text-search/#configuring-bm25-parameters).
|
||||
|
||||
## Embed and Upsert Documents
|
||||
|
||||
Use `embed_document` to generate a sparse vector for each document, then upsert the points. Call `optimize` after bulk inserts to build the sparse index:
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/bm25/" block="embed-and-upsert" >}}
|
||||
|
||||
## Query
|
||||
|
||||
Use `embed_query` to generate a sparse vector for the query text, then query the shard:
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/bm25/" block="query-with-bm25" >}}
|
||||
|
||||
Always use `embed_query` for query text and `embed_document` for document text. Using the wrong function produces incorrect results, since BM25 applies different term weighting depending on the input type.
|
||||
@@ -10,6 +10,8 @@ partition: develop
|
||||
|
||||
When using Python, you can use the [FastEmbed](/documentation/fastembed/) library to generate embeddings for use with Qdrant Edge. FastEmbed provides multimodal models that run efficiently on edge devices to generate vector embeddings from text and images.
|
||||
|
||||
<aside role="status">To generate sparse BM25 embeddings for keyword search, see <a href="/documentation/edge/edge-bm25/">BM25 Embeddings on Qdrant Edge</a>.</aside>
|
||||
|
||||
# Provision the Device
|
||||
|
||||
Assuming the devices on which you will run Qdrant Edge have intermittent or no internet connectivity, you need to provision them with the necessary dependencies and model files ahead of time. First, install FastEmbed and the Qdrant Edge Python bindings:
|
||||
|
||||
@@ -26,6 +26,8 @@ Set up a configuration by creating an instance of `EdgeConfig`. For example:
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/quickstart/" block="configure-edge-shard" >}}
|
||||
|
||||
Qdrant Edge supports all Qdrant quantization methods: Scalar, Product, Binary, and TurboQuant. Configure quantization globally on `EdgeConfig.quantization_config` or override per-vector on `EdgeVectorParams.quantization_config`. See the [Quantization](/documentation/manage-data/quantization/) guide for configuration details.
|
||||
|
||||
## Initialize the Edge Shard
|
||||
|
||||
Now you can create a new `EdgeShard` using `EdgeShard.create` (Python) or `EdgeShard::new` (Rust), passing the storage directory and configuration:
|
||||
@@ -44,6 +46,18 @@ To retrieve a point by ID, use the `retrieve` method:
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/quickstart/" block="retrieve-point" >}}
|
||||
|
||||
## Modify the Vector Schema
|
||||
|
||||
You can add or remove named vectors to an existing Edge Shard's schema. This is useful when migrating to a new embedding model or adding hybrid search to an Edge Shard that already contains data.
|
||||
|
||||
For example, to add a sparse vector for [BM25 keyword search](/documentation/edge/edge-bm25/):
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/quickstart/" block="modify-vector-schema" >}}
|
||||
|
||||
Existing points aren't automatically populated with the new vector. Re-upsert them to add their values for the new field.
|
||||
|
||||
To remove a named vector, use `UpdateOperation.delete_vector_name("text")` (Python) or `VectorNameOperations::DeleteVectorName` (Rust).
|
||||
|
||||
## Create a Payload Index
|
||||
|
||||
To optimize operations like [filtering](#filtering) and [faceting](#faceting) on payload fields, first create a payload index on the fields you plan to use with these operations:
|
||||
@@ -90,6 +104,14 @@ After closing an Edge Shard, you can reopen it by loading its data and configura
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/quickstart/" block="load-edge-shard" >}}
|
||||
|
||||
## Custom WAL Size
|
||||
|
||||
Qdrant Edge uses a Write-Ahead Log (WAL) to record every update before it's applied to storage. The WAL file is pre-allocated to 32 MB by default, inflating backup sizes and OS storage reports. To reduce the size, set `wal_options` on `EdgeConfig` when calling `new` or `load`. WAL options are only available in Rust.
|
||||
|
||||
For example, to set the WAL size to 4 MB:
|
||||
|
||||
{{< code-snippet path="/documentation/headless/snippets/edge/quickstart/" block="wal-options" >}}
|
||||
|
||||
## More Examples
|
||||
|
||||
The Qdrant GitHub repository contains examples of using the Qdrant Edge API in [Python](https://github.com/qdrant/qdrant/tree/dev/lib/edge/python/examples) and [Rust](https://github.com/qdrant/qdrant/tree/dev/lib/edge/publish/examples).
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
```python
|
||||
from qdrant_edge import (
|
||||
EdgeConfig,
|
||||
EdgeShard,
|
||||
EdgeSparseVectorParams,
|
||||
Modifier,
|
||||
)
|
||||
|
||||
config = EdgeConfig(
|
||||
sparse_vectors={"text": EdgeSparseVectorParams(modifier=Modifier.Idf)},
|
||||
)
|
||||
|
||||
shard = EdgeShard.create(SHARD_DIRECTORY, config)
|
||||
```
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
```rust
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.sparse_vector("text", EdgeSparseVectorParamsBuilder::new()
|
||||
.modifier(Modifier::Idf)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
let shard = EdgeShard::new(Path::new(SHARD_DIRECTORY), config)?;
|
||||
```
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
```python
|
||||
from qdrant_edge import Bm25, Bm25Config
|
||||
|
||||
bm25 = Bm25(Bm25Config(language="english"))
|
||||
```
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
```rust
|
||||
let bm25 = EdgeBm25::new(EdgeBm25Config {
|
||||
language: Some("english".to_string()),
|
||||
..Default::default()
|
||||
})?;
|
||||
```
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
```python
|
||||
from qdrant_edge import Point, UpdateOperation
|
||||
|
||||
shard.update(UpdateOperation.upsert_points([
|
||||
Point(1, {"text": bm25.embed_document("the quick brown fox")}, {"title": "Article 1"}),
|
||||
Point(2, {"text": bm25.embed_document("a lazy dog sleeps")}, {"title": "Article 2"}),
|
||||
Point(3, {"text": bm25.embed_document("foxes are clever")}, {"title": "Article 3"}),
|
||||
]))
|
||||
shard.optimize()
|
||||
```
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
```rust
|
||||
let docs = [
|
||||
(1u64, "the quick brown fox", "Article 1"),
|
||||
(2, "a lazy dog sleeps", "Article 2"),
|
||||
(3, "foxes are clever", "Article 3"),
|
||||
];
|
||||
|
||||
let points = docs.iter().map(|(id, text, title)| {
|
||||
PointStruct::new(
|
||||
*id,
|
||||
Vectors::new_named([("text", bm25.embed_document(text))]),
|
||||
json!({ "title": title }),
|
||||
).into()
|
||||
}).collect();
|
||||
|
||||
shard.update(UpdateOperation::PointOperation(
|
||||
PointOperations::UpsertPoints(PointInsertOperations::PointsList(points)),
|
||||
))?;
|
||||
shard.optimize()?;
|
||||
```
|
||||
@@ -0,0 +1,41 @@
|
||||
```python
|
||||
from pathlib import Path
|
||||
|
||||
SHARD_DIRECTORY = "./qdrant-edge-bm25"
|
||||
|
||||
from qdrant_edge import (
|
||||
EdgeConfig,
|
||||
EdgeShard,
|
||||
EdgeSparseVectorParams,
|
||||
Modifier,
|
||||
)
|
||||
|
||||
config = EdgeConfig(
|
||||
sparse_vectors={"text": EdgeSparseVectorParams(modifier=Modifier.Idf)},
|
||||
)
|
||||
|
||||
shard = EdgeShard.create(SHARD_DIRECTORY, config)
|
||||
|
||||
from qdrant_edge import Bm25, Bm25Config
|
||||
|
||||
bm25 = Bm25(Bm25Config(language="english"))
|
||||
|
||||
from qdrant_edge import Point, UpdateOperation
|
||||
|
||||
shard.update(UpdateOperation.upsert_points([
|
||||
Point(1, {"text": bm25.embed_document("the quick brown fox")}, {"title": "Article 1"}),
|
||||
Point(2, {"text": bm25.embed_document("a lazy dog sleeps")}, {"title": "Article 2"}),
|
||||
Point(3, {"text": bm25.embed_document("foxes are clever")}, {"title": "Article 3"}),
|
||||
]))
|
||||
shard.optimize()
|
||||
|
||||
from qdrant_edge import Query, QueryRequest
|
||||
|
||||
query_vector = bm25.embed_query("clever fox")
|
||||
|
||||
results = shard.query(QueryRequest(
|
||||
query=Query.Nearest(query_vector, using="text"),
|
||||
limit=3,
|
||||
with_payload=True,
|
||||
))
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```python
|
||||
from qdrant_edge import Query, QueryRequest
|
||||
|
||||
query_vector = bm25.embed_query("clever fox")
|
||||
|
||||
results = shard.query(QueryRequest(
|
||||
query=Query.Nearest(query_vector, using="text"),
|
||||
limit=3,
|
||||
with_payload=True,
|
||||
))
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
```rust
|
||||
let query_vector = bm25.embed_query("clever fox");
|
||||
|
||||
let results = shard.query(QueryRequest {
|
||||
prefetches: vec![],
|
||||
query: Some(ScoringQuery::Vector(QueryEnum::Nearest(NamedQuery {
|
||||
query: VectorInternal::from(query_vector),
|
||||
using: Some("text".to_string()),
|
||||
}))),
|
||||
filter: None,
|
||||
score_threshold: None,
|
||||
limit: 3,
|
||||
offset: 0,
|
||||
params: None,
|
||||
with_vector: WithVector::Bool(false),
|
||||
with_payload: WithPayloadInterface::Bool(true),
|
||||
})?;
|
||||
```
|
||||
@@ -0,0 +1,63 @@
|
||||
```rust
|
||||
use std::path::Path;
|
||||
|
||||
use qdrant_edge::bm25_embed::{EdgeBm25, EdgeBm25Config};
|
||||
use qdrant_edge::external::serde_json::json;
|
||||
use qdrant_edge::{
|
||||
EdgeConfigBuilder, EdgeShard, EdgeSparseVectorParamsBuilder, Modifier,
|
||||
NamedQuery, PointInsertOperations, PointOperations, PointStruct,
|
||||
QueryEnum, QueryRequest, ScoringQuery, UpdateOperation,
|
||||
VectorInternal, Vectors, WithPayloadInterface, WithVector,
|
||||
};
|
||||
|
||||
const SHARD_DIRECTORY: &str = "./qdrant-edge-bm25";
|
||||
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.sparse_vector("text", EdgeSparseVectorParamsBuilder::new()
|
||||
.modifier(Modifier::Idf)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
let shard = EdgeShard::new(Path::new(SHARD_DIRECTORY), config)?;
|
||||
|
||||
let bm25 = EdgeBm25::new(EdgeBm25Config {
|
||||
language: Some("english".to_string()),
|
||||
..Default::default()
|
||||
})?;
|
||||
|
||||
let docs = [
|
||||
(1u64, "the quick brown fox", "Article 1"),
|
||||
(2, "a lazy dog sleeps", "Article 2"),
|
||||
(3, "foxes are clever", "Article 3"),
|
||||
];
|
||||
|
||||
let points = docs.iter().map(|(id, text, title)| {
|
||||
PointStruct::new(
|
||||
*id,
|
||||
Vectors::new_named([("text", bm25.embed_document(text))]),
|
||||
json!({ "title": title }),
|
||||
).into()
|
||||
}).collect();
|
||||
|
||||
shard.update(UpdateOperation::PointOperation(
|
||||
PointOperations::UpsertPoints(PointInsertOperations::PointsList(points)),
|
||||
))?;
|
||||
shard.optimize()?;
|
||||
|
||||
let query_vector = bm25.embed_query("clever fox");
|
||||
|
||||
let results = shard.query(QueryRequest {
|
||||
prefetches: vec![],
|
||||
query: Some(ScoringQuery::Vector(QueryEnum::Nearest(NamedQuery {
|
||||
query: VectorInternal::from(query_vector),
|
||||
using: Some("text".to_string()),
|
||||
}))),
|
||||
filter: None,
|
||||
score_threshold: None,
|
||||
limit: 3,
|
||||
offset: 0,
|
||||
params: None,
|
||||
with_vector: WithVector::Bool(false),
|
||||
with_payload: WithPayloadInterface::Bool(true),
|
||||
})?;
|
||||
```
|
||||
@@ -0,0 +1,48 @@
|
||||
from pathlib import Path
|
||||
|
||||
SHARD_DIRECTORY = "./qdrant-edge-bm25"
|
||||
Path(SHARD_DIRECTORY).mkdir(parents=True, exist_ok=True) # @hide
|
||||
|
||||
# @block-start configure-bm25-shard
|
||||
from qdrant_edge import (
|
||||
EdgeConfig,
|
||||
EdgeShard,
|
||||
EdgeSparseVectorParams,
|
||||
Modifier,
|
||||
)
|
||||
|
||||
config = EdgeConfig(
|
||||
sparse_vectors={"text": EdgeSparseVectorParams(modifier=Modifier.Idf)},
|
||||
)
|
||||
|
||||
shard = EdgeShard.create(SHARD_DIRECTORY, config)
|
||||
# @block-end configure-bm25-shard
|
||||
|
||||
# @block-start create-bm25
|
||||
from qdrant_edge import Bm25, Bm25Config
|
||||
|
||||
bm25 = Bm25(Bm25Config(language="english"))
|
||||
# @block-end create-bm25
|
||||
|
||||
# @block-start embed-and-upsert
|
||||
from qdrant_edge import Point, UpdateOperation
|
||||
|
||||
shard.update(UpdateOperation.upsert_points([
|
||||
Point(1, {"text": bm25.embed_document("the quick brown fox")}, {"title": "Article 1"}),
|
||||
Point(2, {"text": bm25.embed_document("a lazy dog sleeps")}, {"title": "Article 2"}),
|
||||
Point(3, {"text": bm25.embed_document("foxes are clever")}, {"title": "Article 3"}),
|
||||
]))
|
||||
shard.optimize()
|
||||
# @block-end embed-and-upsert
|
||||
|
||||
# @block-start query-with-bm25
|
||||
from qdrant_edge import Query, QueryRequest
|
||||
|
||||
query_vector = bm25.embed_query("clever fox")
|
||||
|
||||
results = shard.query(QueryRequest(
|
||||
query=Query.Nearest(query_vector, using="text"),
|
||||
limit=3,
|
||||
with_payload=True,
|
||||
))
|
||||
# @block-end query-with-bm25
|
||||
@@ -0,0 +1,74 @@
|
||||
use std::path::Path;
|
||||
|
||||
use qdrant_edge::bm25_embed::{EdgeBm25, EdgeBm25Config};
|
||||
use qdrant_edge::external::serde_json::json;
|
||||
use qdrant_edge::{
|
||||
EdgeConfigBuilder, EdgeShard, EdgeSparseVectorParamsBuilder, Modifier,
|
||||
NamedQuery, PointInsertOperations, PointOperations, PointStruct,
|
||||
QueryEnum, QueryRequest, ScoringQuery, UpdateOperation,
|
||||
VectorInternal, Vectors, WithPayloadInterface, WithVector,
|
||||
};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
const SHARD_DIRECTORY: &str = "./qdrant-edge-bm25";
|
||||
fs_err::create_dir_all(SHARD_DIRECTORY)?; // @hide
|
||||
|
||||
// @block-start configure-bm25-shard
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.sparse_vector("text", EdgeSparseVectorParamsBuilder::new()
|
||||
.modifier(Modifier::Idf)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
let shard = EdgeShard::new(Path::new(SHARD_DIRECTORY), config)?;
|
||||
// @block-end configure-bm25-shard
|
||||
|
||||
// @block-start create-bm25
|
||||
let bm25 = EdgeBm25::new(EdgeBm25Config {
|
||||
language: Some("english".to_string()),
|
||||
..Default::default()
|
||||
})?;
|
||||
// @block-end create-bm25
|
||||
|
||||
// @block-start embed-and-upsert
|
||||
let docs = [
|
||||
(1u64, "the quick brown fox", "Article 1"),
|
||||
(2, "a lazy dog sleeps", "Article 2"),
|
||||
(3, "foxes are clever", "Article 3"),
|
||||
];
|
||||
|
||||
let points = docs.iter().map(|(id, text, title)| {
|
||||
PointStruct::new(
|
||||
*id,
|
||||
Vectors::new_named([("text", bm25.embed_document(text))]),
|
||||
json!({ "title": title }),
|
||||
).into()
|
||||
}).collect();
|
||||
|
||||
shard.update(UpdateOperation::PointOperation(
|
||||
PointOperations::UpsertPoints(PointInsertOperations::PointsList(points)),
|
||||
))?;
|
||||
shard.optimize()?;
|
||||
// @block-end embed-and-upsert
|
||||
|
||||
// @block-start query-with-bm25
|
||||
let query_vector = bm25.embed_query("clever fox");
|
||||
|
||||
let results = shard.query(QueryRequest {
|
||||
prefetches: vec![],
|
||||
query: Some(ScoringQuery::Vector(QueryEnum::Nearest(NamedQuery {
|
||||
query: VectorInternal::from(query_vector),
|
||||
using: Some("text".to_string()),
|
||||
}))),
|
||||
filter: None,
|
||||
score_threshold: None,
|
||||
limit: 3,
|
||||
offset: 0,
|
||||
params: None,
|
||||
with_vector: WithVector::Bool(false),
|
||||
with_payload: WithPayloadInterface::Bool(true),
|
||||
})?;
|
||||
// @block-end query-with-bm25
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+9
-19
@@ -2,23 +2,13 @@
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
const VECTOR_DIMENSION: usize = 4;
|
||||
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
```
|
||||
|
||||
+11
-20
@@ -1,26 +1,17 @@
|
||||
```rust
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: EdgeOptimizersConfig {
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.optimizers(EdgeOptimizersConfig {
|
||||
deleted_threshold: Some(0.2),
|
||||
vacuum_min_vector_number: Some(100),
|
||||
default_segment_number: Some(2),
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
})
|
||||
.build();
|
||||
```
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
```python
|
||||
from qdrant_edge import Modifier
|
||||
|
||||
edge_shard.update(UpdateOperation.create_sparse_vector(
|
||||
vector_name="text",
|
||||
modifier=Modifier.Idf,
|
||||
))
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```rust
|
||||
edge_shard.update(UpdateOperation::VectorNameOperation(
|
||||
VectorNameOperations::CreateVectorName(CreateVectorName {
|
||||
vector_name: "text".to_string(),
|
||||
config: VectorNameConfig::sparse(SparseVectorConfig {
|
||||
modifier: Some(Modifier::Idf),
|
||||
datatype: None,
|
||||
}),
|
||||
}),
|
||||
))?;
|
||||
```
|
||||
+7
@@ -43,6 +43,13 @@ records = edge_shard.retrieve(
|
||||
with_vector=False
|
||||
)
|
||||
|
||||
from qdrant_edge import Modifier
|
||||
|
||||
edge_shard.update(UpdateOperation.create_sparse_vector(
|
||||
vector_name="text",
|
||||
modifier=Modifier.Idf,
|
||||
))
|
||||
|
||||
from qdrant_edge import Query, QueryRequest
|
||||
|
||||
results = edge_shard.query(
|
||||
|
||||
+47
-46
@@ -1,15 +1,16 @@
|
||||
```rust
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
|
||||
use qdrant_edge::EdgeShard;
|
||||
use qdrant_edge::{
|
||||
Condition, CreateIndex, Distance, EdgeConfig, EdgeOptimizersConfig,
|
||||
EdgeVectorParams, FacetRequest, FieldCondition, FieldIndexOperations,
|
||||
Filter, Match, MatchValue, NamedQuery, PayloadFieldSchema,
|
||||
PayloadSchemaType, PointId, PointInsertOperations, PointOperations,
|
||||
PointStruct, PointStructPersisted, QueryEnum, QueryRequest, ScoringQuery,
|
||||
UpdateOperation, ValueVariants, Vectors, WithPayloadInterface, WithVector,
|
||||
Condition, CreateIndex, CreateVectorName, Distance, EdgeConfigBuilder,
|
||||
EdgeOptimizersConfig, EdgeVectorParamsBuilder, FacetRequest, FieldCondition,
|
||||
FieldIndexOperations, Filter, Match, MatchValue, Modifier, NamedQuery,
|
||||
PayloadFieldSchema, PayloadSchemaType, PointId, PointInsertOperations,
|
||||
PointOperations, PointStruct, PointStructPersisted, QueryEnum, QueryRequest,
|
||||
ScoringQuery, SparseVectorConfig, UpdateOperation, ValueVariants,
|
||||
VectorNameConfig, VectorNameOperations, Vectors, WalOptions,
|
||||
WithPayloadInterface, WithVector,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
@@ -20,25 +21,15 @@ fs_err::create_dir_all(SHARD_DIRECTORY)?;
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
const VECTOR_DIMENSION: usize = 4;
|
||||
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let edge_shard = EdgeShard::new(
|
||||
Path::new(SHARD_DIRECTORY),
|
||||
@@ -66,6 +57,16 @@ let retrieved = edge_shard.retrieve(
|
||||
Some(WithVector::Bool(false)),
|
||||
)?;
|
||||
|
||||
edge_shard.update(UpdateOperation::VectorNameOperation(
|
||||
VectorNameOperations::CreateVectorName(CreateVectorName {
|
||||
vector_name: "text".to_string(),
|
||||
config: VectorNameConfig::sparse(SparseVectorConfig {
|
||||
modifier: Some(Modifier::Idf),
|
||||
datatype: None,
|
||||
}),
|
||||
}),
|
||||
))?;
|
||||
|
||||
let results = edge_shard.query(QueryRequest {
|
||||
prefetches: vec![],
|
||||
query: Some(ScoringQuery::Vector(QueryEnum::Nearest(NamedQuery {
|
||||
@@ -117,30 +118,21 @@ let facet_response = edge_shard.facet(FacetRequest {
|
||||
|
||||
edge_shard.optimize()?;
|
||||
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: EdgeOptimizersConfig {
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.optimizers(EdgeOptimizersConfig {
|
||||
deleted_threshold: Some(0.2),
|
||||
vacuum_min_vector_number: Some(100),
|
||||
default_segment_number: Some(2),
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
})
|
||||
.build();
|
||||
|
||||
edge_shard.update(UpdateOperation::FieldIndexOperation(
|
||||
FieldIndexOperations::CreateIndex(CreateIndex {
|
||||
@@ -154,4 +146,13 @@ edge_shard.update(UpdateOperation::FieldIndexOperation(
|
||||
drop(edge_shard);
|
||||
|
||||
let edge_shard = EdgeShard::load(Path::new(SHARD_DIRECTORY), None)?;
|
||||
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.wal_options(WalOptions {
|
||||
segment_capacity: 4 * 1024 * 1024,
|
||||
..Default::default()
|
||||
})
|
||||
.build();
|
||||
|
||||
let edge_shard = EdgeShard::load(Path::new(SHARD_DIRECTORY), Some(config))?;
|
||||
```
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
```rust
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.wal_options(WalOptions {
|
||||
segment_capacity: 4 * 1024 * 1024,
|
||||
..Default::default()
|
||||
})
|
||||
.build();
|
||||
|
||||
let edge_shard = EdgeShard::load(Path::new(SHARD_DIRECTORY), Some(config))?;
|
||||
```
|
||||
@@ -52,6 +52,15 @@ records = edge_shard.retrieve(
|
||||
)
|
||||
# @block-end retrieve-point
|
||||
|
||||
# @block-start modify-vector-schema
|
||||
from qdrant_edge import Modifier
|
||||
|
||||
edge_shard.update(UpdateOperation.create_sparse_vector(
|
||||
vector_name="text",
|
||||
modifier=Modifier.Idf,
|
||||
))
|
||||
# @block-end modify-vector-schema
|
||||
|
||||
# @block-start query-points
|
||||
from qdrant_edge import Query, QueryRequest
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
|
||||
use qdrant_edge::EdgeShard;
|
||||
use qdrant_edge::{
|
||||
Condition, CreateIndex, Distance, EdgeConfig, EdgeOptimizersConfig,
|
||||
EdgeVectorParams, FacetRequest, FieldCondition, FieldIndexOperations,
|
||||
Filter, Match, MatchValue, NamedQuery, PayloadFieldSchema,
|
||||
PayloadSchemaType, PointId, PointInsertOperations, PointOperations,
|
||||
PointStruct, PointStructPersisted, QueryEnum, QueryRequest, ScoringQuery,
|
||||
UpdateOperation, ValueVariants, Vectors, WithPayloadInterface, WithVector,
|
||||
Condition, CreateIndex, CreateVectorName, Distance, EdgeConfigBuilder,
|
||||
EdgeOptimizersConfig, EdgeVectorParamsBuilder, FacetRequest, FieldCondition,
|
||||
FieldIndexOperations, Filter, Match, MatchValue, Modifier, NamedQuery,
|
||||
PayloadFieldSchema, PayloadSchemaType, PointId, PointInsertOperations,
|
||||
PointOperations, PointStruct, PointStructPersisted, QueryEnum, QueryRequest,
|
||||
ScoringQuery, SparseVectorConfig, UpdateOperation, ValueVariants,
|
||||
VectorNameConfig, VectorNameOperations, Vectors, WalOptions,
|
||||
WithPayloadInterface, WithVector,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
@@ -23,25 +24,15 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
const VECTOR_DIMENSION: usize = 4;
|
||||
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
// @block-end configure-edge-shard
|
||||
|
||||
// @block-start initialize-edge-shard
|
||||
@@ -76,6 +67,18 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
)?;
|
||||
// @block-end retrieve-point
|
||||
|
||||
// @block-start modify-vector-schema
|
||||
edge_shard.update(UpdateOperation::VectorNameOperation(
|
||||
VectorNameOperations::CreateVectorName(CreateVectorName {
|
||||
vector_name: "text".to_string(),
|
||||
config: VectorNameConfig::sparse(SparseVectorConfig {
|
||||
modifier: Some(Modifier::Idf),
|
||||
datatype: None,
|
||||
}),
|
||||
}),
|
||||
))?;
|
||||
// @block-end modify-vector-schema
|
||||
|
||||
// @block-start query-points
|
||||
let results = edge_shard.query(QueryRequest {
|
||||
prefetches: vec![],
|
||||
@@ -136,30 +139,21 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
// @block-end optimize
|
||||
|
||||
// @block-start configure-optimizer
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: EdgeOptimizersConfig {
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.optimizers(EdgeOptimizersConfig {
|
||||
deleted_threshold: Some(0.2),
|
||||
vacuum_min_vector_number: Some(100),
|
||||
default_segment_number: Some(2),
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
})
|
||||
.build();
|
||||
// @block-end configure-optimizer
|
||||
|
||||
// @block-start create-payload-index
|
||||
@@ -181,5 +175,16 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
let edge_shard = EdgeShard::load(Path::new(SHARD_DIRECTORY), None)?;
|
||||
// @block-end load-edge-shard
|
||||
|
||||
// @block-start wal-options
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.wal_options(WalOptions {
|
||||
segment_capacity: 4 * 1024 * 1024,
|
||||
..Default::default()
|
||||
})
|
||||
.build();
|
||||
|
||||
let edge_shard = EdgeShard::load(Path::new(SHARD_DIRECTORY), Some(config))?;
|
||||
// @block-end wal-options
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+9
-19
@@ -4,25 +4,15 @@ const VECTOR_DIMENSION: usize = 4;
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
|
||||
fs_err::create_dir_all(MUTABLE_SHARD_DIR)?;
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let mutable_shard = EdgeShard::new(
|
||||
Path::new(MUTABLE_SHARD_DIR),
|
||||
|
||||
+14
-24
@@ -8,11 +8,11 @@ use qdrant_client::qdrant::PointStruct;
|
||||
use qdrant_edge::EdgeShard;
|
||||
use qdrant_edge::internal::SnapshotManifest;
|
||||
use qdrant_edge::{
|
||||
Condition, Distance, EdgeConfig, EdgeVectorParams, FieldCondition, Filter,
|
||||
JsonPath, NamedQuery, PointId, PointInsertOperations, PointOperations,
|
||||
PointStruct as EdgePoint, PointStructPersisted, QueryEnum, QueryRequest,
|
||||
Range, ScoringQuery, UpdateOperation, Vectors, WithPayloadInterface,
|
||||
WithVector,
|
||||
Condition, Distance, EdgeConfigBuilder, EdgeVectorParamsBuilder,
|
||||
FieldCondition, Filter, JsonPath, NamedQuery, PointId, PointInsertOperations,
|
||||
PointOperations, PointStruct as EdgePoint, PointStructPersisted, QueryEnum,
|
||||
QueryRequest, Range, ScoringQuery, UpdateOperation, Vectors,
|
||||
WithPayloadInterface, WithVector,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
@@ -21,25 +21,15 @@ const VECTOR_DIMENSION: usize = 4;
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
|
||||
fs_err::create_dir_all(MUTABLE_SHARD_DIR)?;
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let mutable_shard = EdgeShard::new(
|
||||
Path::new(MUTABLE_SHARD_DIR),
|
||||
|
||||
+14
-24
@@ -7,11 +7,11 @@ use qdrant_client::qdrant::PointStruct;
|
||||
use qdrant_edge::EdgeShard;
|
||||
use qdrant_edge::internal::SnapshotManifest;
|
||||
use qdrant_edge::{
|
||||
Condition, Distance, EdgeConfig, EdgeVectorParams, FieldCondition, Filter,
|
||||
JsonPath, NamedQuery, PointId, PointInsertOperations, PointOperations,
|
||||
PointStruct as EdgePoint, PointStructPersisted, QueryEnum, QueryRequest,
|
||||
Range, ScoringQuery, UpdateOperation, Vectors, WithPayloadInterface,
|
||||
WithVector,
|
||||
Condition, Distance, EdgeConfigBuilder, EdgeVectorParamsBuilder,
|
||||
FieldCondition, Filter, JsonPath, NamedQuery, PointId, PointInsertOperations,
|
||||
PointOperations, PointStruct as EdgePoint, PointStructPersisted, QueryEnum,
|
||||
QueryRequest, Range, ScoringQuery, UpdateOperation, Vectors,
|
||||
WithPayloadInterface, WithVector,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
@@ -29,25 +29,15 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
|
||||
fs_err::create_dir_all(MUTABLE_SHARD_DIR)?;
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let mutable_shard = EdgeShard::new(
|
||||
Path::new(MUTABLE_SHARD_DIR),
|
||||
|
||||
+9
-19
@@ -3,25 +3,15 @@ const VECTOR_DIMENSION: usize = 4;
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
|
||||
fs_err::create_dir_all(SHARD_DIRECTORY)?;
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: qdrant_edge::Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, qdrant_edge::Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let edge_shard = EdgeShard::new(
|
||||
Path::new(SHARD_DIRECTORY),
|
||||
|
||||
+10
-20
@@ -10,7 +10,7 @@ use qdrant_client::Qdrant;
|
||||
use qdrant_edge::EdgeShard;
|
||||
use qdrant_edge::internal::SnapshotManifest;
|
||||
use qdrant_edge::{
|
||||
EdgeConfig, EdgeVectorParams, PointId, PointInsertOperations,
|
||||
EdgeConfigBuilder, EdgeVectorParamsBuilder, PointId, PointInsertOperations,
|
||||
PointOperations, PointStruct as EdgePoint, PointStructPersisted,
|
||||
UpdateOperation, Vectors,
|
||||
};
|
||||
@@ -88,25 +88,15 @@ const VECTOR_DIMENSION: usize = 4;
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
|
||||
fs_err::create_dir_all(SHARD_DIRECTORY)?;
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: qdrant_edge::Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, qdrant_edge::Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let edge_shard = EdgeShard::new(
|
||||
Path::new(SHARD_DIRECTORY),
|
||||
|
||||
+10
-20
@@ -9,7 +9,7 @@ use qdrant_client::Qdrant;
|
||||
use qdrant_edge::EdgeShard;
|
||||
use qdrant_edge::internal::SnapshotManifest;
|
||||
use qdrant_edge::{
|
||||
EdgeConfig, EdgeVectorParams, PointId, PointInsertOperations,
|
||||
EdgeConfigBuilder, EdgeVectorParamsBuilder, PointId, PointInsertOperations,
|
||||
PointOperations, PointStruct as EdgePoint, PointStructPersisted,
|
||||
UpdateOperation, Vectors,
|
||||
};
|
||||
@@ -100,25 +100,15 @@ pub async fn main() -> anyhow::Result<()> {
|
||||
const VECTOR_NAME: &str = "my-vector";
|
||||
|
||||
fs_err::create_dir_all(SHARD_DIRECTORY)?;
|
||||
let config = EdgeConfig {
|
||||
on_disk_payload: true,
|
||||
vectors: HashMap::from([(
|
||||
VECTOR_NAME.to_string(),
|
||||
EdgeVectorParams {
|
||||
size: VECTOR_DIMENSION,
|
||||
distance: qdrant_edge::Distance::Cosine,
|
||||
on_disk: Some(true),
|
||||
quantization_config: None,
|
||||
multivector_config: None,
|
||||
datatype: None,
|
||||
hnsw_config: None,
|
||||
},
|
||||
)]),
|
||||
sparse_vectors: HashMap::new(),
|
||||
hnsw_config: Default::default(),
|
||||
quantization_config: None,
|
||||
optimizers: Default::default(),
|
||||
};
|
||||
let config = EdgeConfigBuilder::new()
|
||||
.on_disk_payload(true)
|
||||
.vector(
|
||||
VECTOR_NAME,
|
||||
EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, qdrant_edge::Distance::Cosine)
|
||||
.on_disk(true)
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let edge_shard = EdgeShard::new(
|
||||
Path::new(SHARD_DIRECTORY),
|
||||
|
||||
Reference in New Issue
Block a user