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:
Abdon Pijpelink
2026-06-03 15:51:20 +02:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 56211977fb
commit ffe50340fa
37 changed files with 924 additions and 642 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ RUN add-apt-repository ppa:dotnet/backports && \
# for rust client # for rust client
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
CARGO_HOME=/opt/rust RUSTUP_HOME=/opt/rust \ CARGO_HOME=/opt/rust RUSTUP_HOME=/opt/rust \
sh -s -- -y --default-toolchain 1.94.0 sh -s -- -y --default-toolchain nightly
# for typescript client # for typescript client
RUN npm install --global --prefix /usr/local pnpm RUN npm install --global --prefix /usr/local pnpm
@@ -6,7 +6,7 @@ dependencies = [
"datasets>=4.4.1", "datasets>=4.4.1",
"fastembed", "fastembed",
"qdrant-client", "qdrant-client",
"qdrant-edge-py==0.6.0" "qdrant-edge-py==0.7.2"
] ]
[tool.uv.sources] [tool.uv.sources]
+10 -10
View File
@@ -1434,17 +1434,17 @@ dependencies = [
[[package]] [[package]]
name = "qdrant-edge-py" name = "qdrant-edge-py"
version = "0.6.0" version = "0.7.2"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/1c/72/fce3df4e4b8882b5b00ab3d0a574bbeee2d39a8e520ccf246f456effd185/qdrant_edge_py-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:c9d463e7fa81541d60ab8671e6e92a9afd8c4a0e2cfb7e13ea8f5d76e70b877a", size = 9728290, upload-time = "2026-03-19T21:16:15.03Z" }, { url = "https://files.pythonhosted.org/packages/56/cb/94de5aebf8380172da89c4028613146cf60da89b37526953495a3e938d67/qdrant_edge_py-0.7.2-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:55198076f0de80330737b53cee99edf95faeffb00aa9bca6bc302e1d601d20b6", size = 10526152, upload-time = "2026-06-01T10:20:58.708Z" },
{ url = "https://files.pythonhosted.org/packages/41/99/70f4e87f7f2ef68c5f92104b914c0e756c22b4bd19957de30a213dadff22/qdrant_edge_py-0.6.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:a18b0bf0355260466bb8d453f2cedc7a9e4f6a2e9d9c58489b859150a3c7e0a6", size = 9203390, upload-time = "2026-03-19T21:16:17.255Z" }, { url = "https://files.pythonhosted.org/packages/0a/b2/21559919e38a039b0d1be85c024b5781cabddb8d50a28250880bc1cab503/qdrant_edge_py-0.7.2-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:fc34918fde9e3762c12c228a7b4e3baaaca6b3f3ddb9c9ae8092090f91d8b761", size = 9891156, upload-time = "2026-06-01T10:21:00.464Z" },
{ url = "https://files.pythonhosted.org/packages/80/55/998ea744a4cef59c69e86b7b2b57ca2f2d4b0f86c212c7b43dd90cc6360e/qdrant_edge_py-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cda53f31d8693d090ec564e6761037f57af6f342ac2eef82e1c160c00d80f331", size = 10287388, upload-time = "2026-03-19T21:16:19.215Z" }, { url = "https://files.pythonhosted.org/packages/d1/32/7fc9515d9645457effd596b5fc018510475a9f7b6d1b02f90593d507a17f/qdrant_edge_py-0.7.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1157924bdcb081af04d2f21c7658e4120e7793b214ac81f77750b359cf921689", size = 11261757, upload-time = "2026-06-01T10:21:02.564Z" },
{ url = "https://files.pythonhosted.org/packages/40/d2/9e24a9c57699fe6df9a4f3b6cd0d4c3c9f0bfdbd502a28d25fdfadd44ab5/qdrant_edge_py-0.6.0-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:80c5e8f8cf650e422a3d313e394bde2760c6206914cd9d6142c9c5e730a76639", size = 9752632, upload-time = "2026-03-19T21:16:21.409Z" }, { url = "https://files.pythonhosted.org/packages/40/ec/2a475eda7f6b83a1a89f2fc41fa2c08294e0f71f735fc45148144a0185c0/qdrant_edge_py-0.7.2-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:c8f070ca8c49e2175b405794c490340638c841459cbbacb79e873bb286f9e9ae", size = 10651844, upload-time = "2026-06-01T10:21:04.442Z" },
{ url = "https://files.pythonhosted.org/packages/0c/3c/a01840efcae392e5a376a483b9a19705ed0f5bc030befbe3d25b58a6d3d4/qdrant_edge_py-0.6.0-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:d2ab0d209f693fd0d5225072441ed47eccee4f7044470a293c54a3ffdf963cfc", size = 10287245, upload-time = "2026-03-19T21:16:24.366Z" }, { url = "https://files.pythonhosted.org/packages/d2/4d/5d3c8ea787f2ffd47d997c575f196e7b7486db404fa6b6fe522be5a10d13/qdrant_edge_py-0.7.2-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f2ecd4cbe6dedfa408b933bfe28917d9274cdfa58243d32ca3c390cd3b1c721e", size = 11259962, upload-time = "2026-06-01T10:21:06.367Z" },
{ url = "https://files.pythonhosted.org/packages/7a/45/a3ec5e7d36c5dd4510e4f90d0adaf6aa3e66cff35884ff3edefce240fd77/qdrant_edge_py-0.6.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9abd0c3aedfed380d4c4a82626004b746bd05cb6a8e28e1b2fe7467726dc8840", size = 9935881, upload-time = "2026-03-19T21:16:26.384Z" }, { url = "https://files.pythonhosted.org/packages/57/ae/18c6990c3a58628f97381e1494916120350fcf05c4d3dfcf82433cedb9a9/qdrant_edge_py-0.7.2-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:93b8c0b4f7d6fc58284dc0533d66bf18742767c1fbaef60ddd47651a79137e57", size = 10825604, upload-time = "2026-06-01T10:21:08.404Z" },
{ url = "https://files.pythonhosted.org/packages/66/0d/43c9033fbb12f0858d5af73b842acb02b3208fe1a31882def2ef23fd560c/qdrant_edge_py-0.6.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:ea51a917fc1b927d799d60e166337b6837ee3da39c23d4dc736b82b67497ff12", size = 10507046, upload-time = "2026-03-19T21:16:28.536Z" }, { url = "https://files.pythonhosted.org/packages/a1/eb/a79ca27405196ad3da8f1fe88c7dc5b3888e25d531c6aed043c5efa48124/qdrant_edge_py-0.7.2-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:b13a892947b5eb2e8ac1a8049fd57a88d1b1d0a390ae2c432d1c0c8b8b0e3c0d", size = 11481427, upload-time = "2026-06-01T10:21:10.604Z" },
{ url = "https://files.pythonhosted.org/packages/73/33/b2ead1c51a59d31d19418e6d6ca8ea3ce0f32f76efdd48248a1a3791357f/qdrant_edge_py-0.6.0-cp310-abi3-win_amd64.whl", hash = "sha256:d8376e30b53fbb5d9ac8b0aea683173096d7a775b351110aee4337460c906e71", size = 9905482, upload-time = "2026-03-19T21:16:30.555Z" }, { url = "https://files.pythonhosted.org/packages/dc/45/e7b1f28f82ba2392bc893ef65f20b8093c917396493f1ca43c1b2db56c09/qdrant_edge_py-0.7.2-cp310-abi3-win_amd64.whl", hash = "sha256:e6642e1f73ff28f6aeb2c377fdbe93dd0fa25db2d0c54936279e77e2d8ffb574", size = 10599513, upload-time = "2026-06-01T10:21:12.703Z" },
] ]
[[package]] [[package]]
@@ -1510,7 +1510,7 @@ requires-dist = [
{ name = "datasets", specifier = ">=4.4.1" }, { name = "datasets", specifier = ">=4.4.1" },
{ name = "fastembed" }, { name = "fastembed" },
{ name = "qdrant-client", git = "https://github.com/qdrant/qdrant-client?tag=v1.18.0" }, { name = "qdrant-client", git = "https://github.com/qdrant/qdrant-client?tag=v1.18.0" },
{ name = "qdrant-edge-py", specifier = "==0.6.0" }, { name = "qdrant-edge-py", specifier = "==0.7.2" },
] ]
[package.metadata.requires-dev] [package.metadata.requires-dev]
File diff suppressed because it is too large Load Diff
@@ -7,7 +7,7 @@ edition = "2024"
anyhow = "1.0.100" anyhow = "1.0.100"
chrono = "0.4" chrono = "0.4"
csv = "1.3" csv = "1.3"
qdrant-edge = "0.6.0" qdrant-edge = "0.7.2"
fs-err = "3" fs-err = "3"
ordered-float = "5" ordered-float = "5"
qdrant-client = { git = "https://github.com/qdrant/rust-client", branch = "master" } qdrant-client = { git = "https://github.com/qdrant/rust-client", branch = "master" }
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"
@@ -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** | [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 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 | | **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 | | **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. 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 # 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: 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" >}} {{< 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 ## 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: 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" >}} {{< 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 ## 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: 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" >}} {{< 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 ## 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). 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).
@@ -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)
```
@@ -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)?;
```
@@ -0,0 +1,5 @@
```python
from qdrant_edge import Bm25, Bm25Config
bm25 = Bm25(Bm25Config(language="english"))
```
@@ -0,0 +1,6 @@
```rust
let bm25 = EdgeBm25::new(EdgeBm25Config {
language: Some("english".to_string()),
..Default::default()
})?;
```
@@ -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()
```
@@ -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,
))
```
@@ -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,
))
```
@@ -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(())
}
@@ -2,23 +2,13 @@
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
const VECTOR_DIMENSION: usize = 4; const VECTOR_DIMENSION: usize = 4;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
``` ```
@@ -1,26 +1,17 @@
```rust ```rust
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .optimizers(EdgeOptimizersConfig {
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: EdgeOptimizersConfig {
deleted_threshold: Some(0.2), deleted_threshold: Some(0.2),
vacuum_min_vector_number: Some(100), vacuum_min_vector_number: Some(100),
default_segment_number: Some(2), default_segment_number: Some(2),
..Default::default() ..Default::default()
}, })
}; .build();
``` ```
@@ -0,0 +1,8 @@
```python
from qdrant_edge import Modifier
edge_shard.update(UpdateOperation.create_sparse_vector(
vector_name="text",
modifier=Modifier.Idf,
))
```
@@ -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,
}),
}),
))?;
```
@@ -43,6 +43,13 @@ records = edge_shard.retrieve(
with_vector=False 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 from qdrant_edge import Query, QueryRequest
results = edge_shard.query( results = edge_shard.query(
@@ -1,15 +1,16 @@
```rust ```rust
use std::collections::HashMap;
use std::path::Path; use std::path::Path;
use qdrant_edge::EdgeShard; use qdrant_edge::EdgeShard;
use qdrant_edge::{ use qdrant_edge::{
Condition, CreateIndex, Distance, EdgeConfig, EdgeOptimizersConfig, Condition, CreateIndex, CreateVectorName, Distance, EdgeConfigBuilder,
EdgeVectorParams, FacetRequest, FieldCondition, FieldIndexOperations, EdgeOptimizersConfig, EdgeVectorParamsBuilder, FacetRequest, FieldCondition,
Filter, Match, MatchValue, NamedQuery, PayloadFieldSchema, FieldIndexOperations, Filter, Match, MatchValue, Modifier, NamedQuery,
PayloadSchemaType, PointId, PointInsertOperations, PointOperations, PayloadFieldSchema, PayloadSchemaType, PointId, PointInsertOperations,
PointStruct, PointStructPersisted, QueryEnum, QueryRequest, ScoringQuery, PointOperations, PointStruct, PointStructPersisted, QueryEnum, QueryRequest,
UpdateOperation, ValueVariants, Vectors, WithPayloadInterface, WithVector, ScoringQuery, SparseVectorConfig, UpdateOperation, ValueVariants,
VectorNameConfig, VectorNameOperations, Vectors, WalOptions,
WithPayloadInterface, WithVector,
}; };
use serde_json::json; use serde_json::json;
@@ -20,25 +21,15 @@ fs_err::create_dir_all(SHARD_DIRECTORY)?;
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
const VECTOR_DIMENSION: usize = 4; const VECTOR_DIMENSION: usize = 4;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
let edge_shard = EdgeShard::new( let edge_shard = EdgeShard::new(
Path::new(SHARD_DIRECTORY), Path::new(SHARD_DIRECTORY),
@@ -66,6 +57,16 @@ let retrieved = edge_shard.retrieve(
Some(WithVector::Bool(false)), 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 { let results = edge_shard.query(QueryRequest {
prefetches: vec![], prefetches: vec![],
query: Some(ScoringQuery::Vector(QueryEnum::Nearest(NamedQuery { query: Some(ScoringQuery::Vector(QueryEnum::Nearest(NamedQuery {
@@ -117,30 +118,21 @@ let facet_response = edge_shard.facet(FacetRequest {
edge_shard.optimize()?; edge_shard.optimize()?;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .optimizers(EdgeOptimizersConfig {
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: EdgeOptimizersConfig {
deleted_threshold: Some(0.2), deleted_threshold: Some(0.2),
vacuum_min_vector_number: Some(100), vacuum_min_vector_number: Some(100),
default_segment_number: Some(2), default_segment_number: Some(2),
..Default::default() ..Default::default()
}, })
}; .build();
edge_shard.update(UpdateOperation::FieldIndexOperation( edge_shard.update(UpdateOperation::FieldIndexOperation(
FieldIndexOperations::CreateIndex(CreateIndex { FieldIndexOperations::CreateIndex(CreateIndex {
@@ -154,4 +146,13 @@ edge_shard.update(UpdateOperation::FieldIndexOperation(
drop(edge_shard); drop(edge_shard);
let edge_shard = EdgeShard::load(Path::new(SHARD_DIRECTORY), None)?; 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))?;
``` ```
@@ -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-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 # @block-start query-points
from qdrant_edge import Query, QueryRequest from qdrant_edge import Query, QueryRequest
@@ -1,14 +1,15 @@
use std::collections::HashMap;
use std::path::Path; use std::path::Path;
use qdrant_edge::EdgeShard; use qdrant_edge::EdgeShard;
use qdrant_edge::{ use qdrant_edge::{
Condition, CreateIndex, Distance, EdgeConfig, EdgeOptimizersConfig, Condition, CreateIndex, CreateVectorName, Distance, EdgeConfigBuilder,
EdgeVectorParams, FacetRequest, FieldCondition, FieldIndexOperations, EdgeOptimizersConfig, EdgeVectorParamsBuilder, FacetRequest, FieldCondition,
Filter, Match, MatchValue, NamedQuery, PayloadFieldSchema, FieldIndexOperations, Filter, Match, MatchValue, Modifier, NamedQuery,
PayloadSchemaType, PointId, PointInsertOperations, PointOperations, PayloadFieldSchema, PayloadSchemaType, PointId, PointInsertOperations,
PointStruct, PointStructPersisted, QueryEnum, QueryRequest, ScoringQuery, PointOperations, PointStruct, PointStructPersisted, QueryEnum, QueryRequest,
UpdateOperation, ValueVariants, Vectors, WithPayloadInterface, WithVector, ScoringQuery, SparseVectorConfig, UpdateOperation, ValueVariants,
VectorNameConfig, VectorNameOperations, Vectors, WalOptions,
WithPayloadInterface, WithVector,
}; };
use serde_json::json; use serde_json::json;
@@ -23,25 +24,15 @@ pub async fn main() -> anyhow::Result<()> {
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
const VECTOR_DIMENSION: usize = 4; const VECTOR_DIMENSION: usize = 4;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
// @block-end configure-edge-shard // @block-end configure-edge-shard
// @block-start initialize-edge-shard // @block-start initialize-edge-shard
@@ -76,6 +67,18 @@ pub async fn main() -> anyhow::Result<()> {
)?; )?;
// @block-end retrieve-point // @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 // @block-start query-points
let results = edge_shard.query(QueryRequest { let results = edge_shard.query(QueryRequest {
prefetches: vec![], prefetches: vec![],
@@ -136,30 +139,21 @@ pub async fn main() -> anyhow::Result<()> {
// @block-end optimize // @block-end optimize
// @block-start configure-optimizer // @block-start configure-optimizer
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .optimizers(EdgeOptimizersConfig {
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: EdgeOptimizersConfig {
deleted_threshold: Some(0.2), deleted_threshold: Some(0.2),
vacuum_min_vector_number: Some(100), vacuum_min_vector_number: Some(100),
default_segment_number: Some(2), default_segment_number: Some(2),
..Default::default() ..Default::default()
}, })
}; .build();
// @block-end configure-optimizer // @block-end configure-optimizer
// @block-start create-payload-index // @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)?; let edge_shard = EdgeShard::load(Path::new(SHARD_DIRECTORY), None)?;
// @block-end load-edge-shard // @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(()) Ok(())
} }
@@ -4,25 +4,15 @@ const VECTOR_DIMENSION: usize = 4;
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
fs_err::create_dir_all(MUTABLE_SHARD_DIR)?; fs_err::create_dir_all(MUTABLE_SHARD_DIR)?;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
let mutable_shard = EdgeShard::new( let mutable_shard = EdgeShard::new(
Path::new(MUTABLE_SHARD_DIR), Path::new(MUTABLE_SHARD_DIR),
@@ -8,11 +8,11 @@ use qdrant_client::qdrant::PointStruct;
use qdrant_edge::EdgeShard; use qdrant_edge::EdgeShard;
use qdrant_edge::internal::SnapshotManifest; use qdrant_edge::internal::SnapshotManifest;
use qdrant_edge::{ use qdrant_edge::{
Condition, Distance, EdgeConfig, EdgeVectorParams, FieldCondition, Filter, Condition, Distance, EdgeConfigBuilder, EdgeVectorParamsBuilder,
JsonPath, NamedQuery, PointId, PointInsertOperations, PointOperations, FieldCondition, Filter, JsonPath, NamedQuery, PointId, PointInsertOperations,
PointStruct as EdgePoint, PointStructPersisted, QueryEnum, QueryRequest, PointOperations, PointStruct as EdgePoint, PointStructPersisted, QueryEnum,
Range, ScoringQuery, UpdateOperation, Vectors, WithPayloadInterface, QueryRequest, Range, ScoringQuery, UpdateOperation, Vectors,
WithVector, WithPayloadInterface, WithVector,
}; };
use serde_json::json; use serde_json::json;
@@ -21,25 +21,15 @@ const VECTOR_DIMENSION: usize = 4;
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
fs_err::create_dir_all(MUTABLE_SHARD_DIR)?; fs_err::create_dir_all(MUTABLE_SHARD_DIR)?;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
let mutable_shard = EdgeShard::new( let mutable_shard = EdgeShard::new(
Path::new(MUTABLE_SHARD_DIR), Path::new(MUTABLE_SHARD_DIR),
@@ -7,11 +7,11 @@ use qdrant_client::qdrant::PointStruct;
use qdrant_edge::EdgeShard; use qdrant_edge::EdgeShard;
use qdrant_edge::internal::SnapshotManifest; use qdrant_edge::internal::SnapshotManifest;
use qdrant_edge::{ use qdrant_edge::{
Condition, Distance, EdgeConfig, EdgeVectorParams, FieldCondition, Filter, Condition, Distance, EdgeConfigBuilder, EdgeVectorParamsBuilder,
JsonPath, NamedQuery, PointId, PointInsertOperations, PointOperations, FieldCondition, Filter, JsonPath, NamedQuery, PointId, PointInsertOperations,
PointStruct as EdgePoint, PointStructPersisted, QueryEnum, QueryRequest, PointOperations, PointStruct as EdgePoint, PointStructPersisted, QueryEnum,
Range, ScoringQuery, UpdateOperation, Vectors, WithPayloadInterface, QueryRequest, Range, ScoringQuery, UpdateOperation, Vectors,
WithVector, WithPayloadInterface, WithVector,
}; };
use serde_json::json; use serde_json::json;
@@ -29,25 +29,15 @@ pub async fn main() -> anyhow::Result<()> {
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
fs_err::create_dir_all(MUTABLE_SHARD_DIR)?; fs_err::create_dir_all(MUTABLE_SHARD_DIR)?;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
let mutable_shard = EdgeShard::new( let mutable_shard = EdgeShard::new(
Path::new(MUTABLE_SHARD_DIR), Path::new(MUTABLE_SHARD_DIR),
@@ -3,25 +3,15 @@ const VECTOR_DIMENSION: usize = 4;
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
fs_err::create_dir_all(SHARD_DIRECTORY)?; fs_err::create_dir_all(SHARD_DIRECTORY)?;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, qdrant_edge::Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: qdrant_edge::Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
let edge_shard = EdgeShard::new( let edge_shard = EdgeShard::new(
Path::new(SHARD_DIRECTORY), Path::new(SHARD_DIRECTORY),
@@ -10,7 +10,7 @@ use qdrant_client::Qdrant;
use qdrant_edge::EdgeShard; use qdrant_edge::EdgeShard;
use qdrant_edge::internal::SnapshotManifest; use qdrant_edge::internal::SnapshotManifest;
use qdrant_edge::{ use qdrant_edge::{
EdgeConfig, EdgeVectorParams, PointId, PointInsertOperations, EdgeConfigBuilder, EdgeVectorParamsBuilder, PointId, PointInsertOperations,
PointOperations, PointStruct as EdgePoint, PointStructPersisted, PointOperations, PointStruct as EdgePoint, PointStructPersisted,
UpdateOperation, Vectors, UpdateOperation, Vectors,
}; };
@@ -88,25 +88,15 @@ const VECTOR_DIMENSION: usize = 4;
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
fs_err::create_dir_all(SHARD_DIRECTORY)?; fs_err::create_dir_all(SHARD_DIRECTORY)?;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, qdrant_edge::Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: qdrant_edge::Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
let edge_shard = EdgeShard::new( let edge_shard = EdgeShard::new(
Path::new(SHARD_DIRECTORY), Path::new(SHARD_DIRECTORY),
@@ -9,7 +9,7 @@ use qdrant_client::Qdrant;
use qdrant_edge::EdgeShard; use qdrant_edge::EdgeShard;
use qdrant_edge::internal::SnapshotManifest; use qdrant_edge::internal::SnapshotManifest;
use qdrant_edge::{ use qdrant_edge::{
EdgeConfig, EdgeVectorParams, PointId, PointInsertOperations, EdgeConfigBuilder, EdgeVectorParamsBuilder, PointId, PointInsertOperations,
PointOperations, PointStruct as EdgePoint, PointStructPersisted, PointOperations, PointStruct as EdgePoint, PointStructPersisted,
UpdateOperation, Vectors, UpdateOperation, Vectors,
}; };
@@ -100,25 +100,15 @@ pub async fn main() -> anyhow::Result<()> {
const VECTOR_NAME: &str = "my-vector"; const VECTOR_NAME: &str = "my-vector";
fs_err::create_dir_all(SHARD_DIRECTORY)?; fs_err::create_dir_all(SHARD_DIRECTORY)?;
let config = EdgeConfig { let config = EdgeConfigBuilder::new()
on_disk_payload: true, .on_disk_payload(true)
vectors: HashMap::from([( .vector(
VECTOR_NAME.to_string(), VECTOR_NAME,
EdgeVectorParams { EdgeVectorParamsBuilder::new(VECTOR_DIMENSION, qdrant_edge::Distance::Cosine)
size: VECTOR_DIMENSION, .on_disk(true)
distance: qdrant_edge::Distance::Cosine, .build(),
on_disk: Some(true), )
quantization_config: None, .build();
multivector_config: None,
datatype: None,
hnsw_config: None,
},
)]),
sparse_vectors: HashMap::new(),
hnsw_config: Default::default(),
quantization_config: None,
optimizers: Default::default(),
};
let edge_shard = EdgeShard::new( let edge_shard = EdgeShard::new(
Path::new(SHARD_DIRECTORY), Path::new(SHARD_DIRECTORY),