* 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>
3.5 KiB
title, short_description, description, weight, partition
| title | short_description | description | weight | partition |
|---|---|---|---|---|
| BM25 | Generate BM25 sparse embeddings for keyword search with Qdrant Edge, compatible with server-side BM25 collections. | 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. | 16 | develop |
BM25 with Qdrant Edge
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 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.
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.