Build a vector search engine
Stage 5 of 5v1 · 588a8930

Query and evaluate the index

Navigate the graph with efSearch and compare recall against the exact baseline.

Speed with a quality measure

When mode is approximate, require a current index and a positive efSearch. Navigate greedily from the top-layer entry point, descend through layers, and keep up to efSearch candidates on layer zero. Return the best k plus visited, the number of distinct nodes whose distance you computed.

When efSearch is at least the number of nodes, visit the whole store; this guarantees exact results and makes small cases reproducible. Without mode, search preserves the previous exhaustive behavior.

evaluate receives a list of queries and computes approximate and exact ids for each. Report the average |approximate ∩ exact| / k, rounded to six decimals, and the query count.

Acceptance criteria

  • Never query a stale index.
  • visited counts unique distance calculations.
  • Recall compares ids, not rounded distances.