计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
cpp-header-api【效率与协作】Operate hnswlib's C++11 header-only API for HNSW and brute-force indexes, filters, persistence, deletion/replacement, stop conditions, multivector search, and bounded concurrency.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task is about the C++ or header-only interface: including
hnswlib/hnswlib.h, constructing HierarchicalNSW, searchKnn,
searchKnnCloserFirst, BaseFilterFunctor, markDelete, addPoint,
saveIndex, CMake, epsilon search, multivector search, or C++ concurrency.
This skill covers the 0.9.0 header API and the installed CPU-native extension
facts; it does not expand the Python binding surface.
hnswlib/ headers. Do not assume
a particular checkout layout, build directory, virtual environment, or dataset.SpaceInterface object alive until every index using it has been
destroyed. The index retains its distance function and parameter pointer.float with L2Space or InnerProductSpace for the normal vector API.
Read api-reference.md before selecting an
optional stop-condition or multivector signature.<hnswlib/hnswlib.h>, compile as C++11,
add the include root, and use -pthread (or the platform equivalent) for code
using the library's mutexes/threads. Use workflows.md
for direct compiler and CMake patterns.L2Space(dim) for squared
Euclidean distance or InnerProductSpace(dim) for 1 - inner product.
Construct HierarchicalNSW<float> with capacity, M, ef_construction,
seed, and replacement policy. Prefer stack ownership or an RAII owner.addPoint. A repeated label updates its existing
item. Increase capacity with resizeIndex before inserting, or use the
persistence-based capacity extension described in the references.searchKnn returns a priority queue
whose top() is the farthest member of the retained result set. Drain and
reverse it, or call searchKnnCloserFirst for a vector ordered closest first.
A filter is a live pointer to a functor that accepts external labels.markDelete only marks; it does not remove
graph connections. Replacement requires construction/load with
allow_replace_deleted=true and addPoint(..., true). Do not call
unmarkDelete as a recovery mechanism while replacement is enabled.saveIndex(file), destroy the index if
desired, then construct the load form with the same compatible space. Set
ef again after loading: it is not saved and loading initializes it to 10.ef, capacity, paths, deletion policy, and
benchmark exclusions: troubleshooting.md.scripts/run_cpp_smoke.sh --include-dir <include-root>.replace_deleted=true unless the index was created or loaded with
replacement enabled. Do not use a filter to make an unavailable k appear
available: filtering can legitimately return fewer than k items.Before handing off a C++ solution, confirm:
M, ef_construction, capacity, and query ef have an intentional value;k matches;ef explicitly;