api-and-indexing
Build, update, search, filter, and safely manage LEANN indexes through the Python API, including precomputed embeddings and hybrid or grep retrieval.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- api-and-indexing
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Build, update, search, filter, and safely manage LEANN indexes through the Python API, including precomputed embeddings and hybrid or grep retrieval.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md8.9 KB
- 参考文档references/indexing-and-search-workflows.md8.3 KB
- 参考文档references/metadata-hybrid-and-grep.md6.6 KB
- 参考文档references/troubleshooting.md10.0 KB
03 SKILL.md 正文
LEANN API and Indexing
Use this sub-skill for the Python lifecycle around LeannBuilder,
LeannSearcher, passage metadata, precomputed vectors, low-level updates,
metadata filters, BM25/vector fusion, grep retrieval, and resource cleanup.
Route by task
- Verify constructors, method signatures, defaults, result fields, and artifact names in API reference.
- Implement a new build, precomputed-vector build, update, staged replacement, or cleanup flow with indexing and search workflows.
- Configure post-search metadata filters, pure BM25, hybrid retrieval, or grep with metadata, hybrid, and grep.
- Diagnose bad base paths, missing artifacts, dimension or ID mismatches, update duplication, BM25/grep failures, and daemon cleanup with troubleshooting.
- Prove a local installation and HNSW backend without a model download by running the bundled precomputed-index smoke.
Operating rules
- Treat
index_pathas a base path, not as the.meta.json,.index, or passage file. Keep every sibling artifact together. - Use a new staging directory for builds and critical updates. Validate it, then publish the whole directory; never overwrite unrelated files or delete a parent directory in response to an error message.
- Give every passage a unique string ID. For precomputed arrays, make the passage IDs and supplied vector IDs identical and order-aligned.
- Set build and query embedding configuration consistently. A precomputed build avoids document embedding, but semantic search still needs a query embedding; pure BM25 and grep do not.
- Configure recomputation on
LeannSearcher; the per-call search override is deprecated. Disable warmup and daemon use for offline BM25-only checks. - Always call
cleanup()or usewith LeannSearcher(...) as searcher:. - Treat filters as post-retrieval filters. Missing or unsupported fields do not raise by default; they remove the affected result.
- Choose update behavior from stored backend/index metadata. IVF supports remove-then-add; HNSW only supports low-level append on non-compact indexes.
Boundaries
- For CLI build/search, daemon commands, filesystem watching, or idempotent document builds, use CLI operations.
- For HNSW, IVF, DiskANN algorithms, storage modes, and backend tuning, use backends and storage.
- For embedding modes, model/provider credentials, prompt templates, and chat providers, use embeddings and chat.
- For document, email, browser, chat-history, or code ingestion applications, use RAG applications.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.