add test
This commit is contained in:
14
issue_159.py
14
issue_159.py
@@ -39,8 +39,9 @@ def test_search_performance():
|
|||||||
print("Testing LEANN Search Performance (Issue #159)")
|
print("Testing LEANN Search Performance (Issue #159)")
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
|
|
||||||
# Check if index exists
|
# Check if index exists - skip build if it does
|
||||||
if Path(INDEX_PATH).exists():
|
index_path = Path(INDEX_PATH)
|
||||||
|
if True:
|
||||||
print(f"\n✓ Index already exists at {INDEX_PATH}")
|
print(f"\n✓ Index already exists at {INDEX_PATH}")
|
||||||
print(" Skipping build phase. Delete the index to rebuild.")
|
print(" Skipping build phase. Delete the index to rebuild.")
|
||||||
else:
|
else:
|
||||||
@@ -77,6 +78,15 @@ def test_search_performance():
|
|||||||
|
|
||||||
test_query = "LEANN向量数据库存储优化"
|
test_query = "LEANN向量数据库存储优化"
|
||||||
|
|
||||||
|
# Test with default complexity (64)
|
||||||
|
print(f"\n Test 1: Default complexity (64) `1 ")
|
||||||
|
print(f" Query: '{test_query}'")
|
||||||
|
start_time = time.time()
|
||||||
|
results = searcher.search(test_query, top_k=10, complexity=64, beam_width=BEAM_WIDTH)
|
||||||
|
search_time = time.time() - start_time
|
||||||
|
print(f" ✓ Search completed in {search_time:.2f} seconds")
|
||||||
|
print(f" Results: {len(results)} items")
|
||||||
|
|
||||||
# Test with default complexity (64)
|
# Test with default complexity (64)
|
||||||
print(f"\n Test 1: Default complexity (64)")
|
print(f"\n Test 1: Default complexity (64)")
|
||||||
print(f" Query: '{test_query}'")
|
print(f" Query: '{test_query}'")
|
||||||
|
|||||||
Reference in New Issue
Block a user