Spaces:
Running
Running
File size: 1,105 Bytes
fe002f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
from src.search.vector_search import (
search_vector_with_expansion,
search_vector_with_reranking,
)
if __name__ == "__main__":
query = "wireless headphones"
print(f"=== Testing: {query} ===\n")
# Stage 3: Query Expansion
print("STAGE 3: Query Expansion Results")
results_3 = search_vector_with_expansion(query)
for i, r in enumerate(results_3[:5], 1):
print(f"{i}. [{r['score']:.4f}] {r['product_name']}")
print("\n" + "=" * 80 + "\n")
# Stage 4: Reranking
print("STAGE 4: Reranking Results")
results_4 = search_vector_with_reranking(query)
for i, r in enumerate(results_4[:5], 1):
print(f"{i}. [{r['score']:.4f}] {r['product_name']}")
print("\n" + "=" * 80 + "\n")
print("Analysis:")
print(
f"Stage 3 Top-1: {results_3[0]['score']:.4f} - {results_3[0]['product_name']}"
)
print(
f"Stage 4 Top-1: {results_4[0]['score']:.4f} - {results_4[0]['product_name']}"
)
if results_3[0]["product_name"] != results_4[0]["product_name"]:
print("\n⚠️ Reranker changed the top result!")
|