promptdojo_

Retrieval metrics and vector-DB shape — recall@k, MRR, and why the filter runs before the search — step 5 of 7

The multiple-choice bug, live. search ranks every tenant's rows, slices the top-2, THEN filters by tenant — so acme gets an empty list while its own refund policy sits in the index at 0.81.

Rearrange the function so the tenant filter runs before the rank-and-slice.

Expected output:

['acme/refunds', 'acme/sla']
The break is on lines 10, 11 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.