mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-30 20:21:09 +08:00
Implement ANN index using HNSW algorithm and update related tests
- Added ANNIndex class for approximate nearest neighbor search using HNSW. - Integrated ANN index with VectorStore for enhanced search capabilities. - Updated test suite for ANN index, including tests for adding, searching, saving, and loading vectors. - Modified existing tests to accommodate changes in search performance expectations. - Improved error handling for file operations in tests to ensure compatibility with Windows file locks. - Adjusted hybrid search performance assertions for increased stability in CI environments.
This commit is contained in:
@@ -435,6 +435,10 @@ class TestVectorStoreCache:
|
||||
chunk.embedding = embedder.embed_single(chunk.content)
|
||||
vector_store.add_chunk(chunk, "/test/a.py")
|
||||
|
||||
# Force brute-force mode to populate cache (disable ANN)
|
||||
original_ann = vector_store._ann_index
|
||||
vector_store._ann_index = None
|
||||
|
||||
# Trigger cache population
|
||||
query_embedding = embedder.embed_single("function")
|
||||
vector_store.search_similar(query_embedding)
|
||||
@@ -445,6 +449,9 @@ class TestVectorStoreCache:
|
||||
|
||||
assert vector_store._embedding_matrix is None
|
||||
|
||||
# Restore ANN index
|
||||
vector_store._ann_index = original_ann
|
||||
|
||||
|
||||
# === Semantic Search Accuracy Tests ===
|
||||
|
||||
|
||||
Reference in New Issue
Block a user