test_search_matches_every_token_not_the_literal_phrase¶
Tests › tests/test_query.py
What this test is for
Why it exists
#45: search was a single literal LIKE '%<whole query>%', so any multi-word query returned NOTHING — '%lock acquisition%' is a substring no identifier contains. Verified on clew's own index before the fix: search('lock') gave 9 hits, search('lock acquisition') gave ZERO, and the empty envelope then asserted "This is a definitive empty result ... Do not retry". Search is the discovery entry point; if a natural phrase answers nothing, a consumer never reaches dossier or chain_trace at all.
Verifies REQ-DDB-QUERY-002
Given
- —
When
single = q.search(rich_db, "sensor")both = q.search(rich_db, "sensor poll")q.search(rich_db, "poll sensor")
Then
- ✓ single holds
- ✓ any(h.name == "sensor_poll" for h in both) holds
- ✓ {h.name for h in q.search(rich_db, "poll sensor")} equals {h.name for h in both}
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
clew — `main` (clew/cli.py) · 35 of 400 steps
… 211 earlier steps
… 147 later steps
2 more
- `main` (scripts/export_parity.py) · 35 of 203 steps
- Look up one name: everything the index holds about it · 3 of 226 steps
tests/test_query.py:1459 · its file's page
What it checks (3)
assert single, "single-token search must still work"observessearchviasingleassert any(h.name == "sensor_poll" for h in both)observessearchviabothassert {h.name for h in q.search(rich_db, "poll sensor")} == {h.name for h in both}observessearch
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-QUERY-002 | catalog | unknown |
Also reaches 5 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-004 measured
- REQ-DDB-QUERY-001 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-007 measured
- REQ-DDB-QUERY-012 measured