mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +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:
@@ -166,6 +166,7 @@ def login_handler(credentials: dict) -> bool:
|
||||
conn.commit()
|
||||
|
||||
# Generate embeddings
|
||||
vector_store = None
|
||||
try:
|
||||
from codexlens.semantic.embedder import Embedder
|
||||
from codexlens.semantic.vector_store import VectorStore
|
||||
@@ -192,12 +193,19 @@ def login_handler(credentials: dict) -> bool:
|
||||
|
||||
except Exception as exc:
|
||||
pytest.skip(f"Failed to generate embeddings: {exc}")
|
||||
finally:
|
||||
if vector_store is not None:
|
||||
vector_store.close()
|
||||
|
||||
yield db_path
|
||||
store.close()
|
||||
|
||||
if db_path.exists():
|
||||
db_path.unlink()
|
||||
# Ignore file deletion errors on Windows (SQLite file lock)
|
||||
try:
|
||||
if db_path.exists():
|
||||
db_path.unlink()
|
||||
except PermissionError:
|
||||
pass # Ignore Windows file lock errors
|
||||
|
||||
def test_pure_vector_with_embeddings(self, db_with_embeddings):
|
||||
"""Test pure vector search returns results when embeddings exist."""
|
||||
|
||||
Reference in New Issue
Block a user