FAILURE MAP
← Case archive

FA-11841 / Search retrieval semantics / Open access

Stopword position holes disappear from phrase matching · case 01

Stopword position holes disappear from phrase matching.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The matcher compares term presence rather than the original positional distance.

VERIFIED REPAIR

Intersect starting offsets after subtracting each query position.

Unsuccessful approach: Requiring adjacent terms still ignores query holes retained by the analyzer.

Case contract

Given postings term->integer positions and query [term,relative position] pairs, report whether all terms share a start offset. Empty query is false.

Why this case matters

An offline deterministic retrieval model isolates this search contract from tokenization, storage, and network behavior.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(postings, query):
    return bool(query) and all(postings.get(t) for t,p in query)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retained hole', solve({'a':[N],'b':[N+2]}, [['a',0],['b',2]]), True)
check('adjacency is wrong for hole', solve({'a':[N],'b':[N+1]}, [['a',0],['b',2]]), False)
check('reversed order', solve({'a':[N+2],'b':[N]}, [['a',0],['b',2]]), False)
check('later occurrence', solve({'a':[0,N+3],'b':[N+5]}, [['a',0],['b',2]]), True)
check('missing term', solve({'a':[N]}, [['a',0],['b',2]]), False)
check('empty query', solve({}, []), False)
check('repeated term', solve({'a':[N,N+2]}, [['a',0],['a',2]]), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
retained holeTrueTruePassed
adjacency is wrong for holeTrueFalseFailed
reversed orderTrueFalseFailed
later occurrenceTrueTruePassed
missing termFalseFalsePassed
empty queryFalseFalsePassed
repeated termTrueTruePassed

SHA-256 / df652a297a50d2cca23c80a30d621bb3e31e1258e0bcb03c2fcfb69aa065bcd1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(postings, query):
    return bool(query) and any(all(s+i in postings.get(t,[]) for i,(t,p) in enumerate(query)) for s in postings.get(query[0][0],[]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retained hole', solve({'a':[N],'b':[N+2]}, [['a',0],['b',2]]), True)
check('adjacency is wrong for hole', solve({'a':[N],'b':[N+1]}, [['a',0],['b',2]]), False)
check('reversed order', solve({'a':[N+2],'b':[N]}, [['a',0],['b',2]]), False)
check('later occurrence', solve({'a':[0,N+3],'b':[N+5]}, [['a',0],['b',2]]), True)
check('missing term', solve({'a':[N]}, [['a',0],['b',2]]), False)
check('empty query', solve({}, []), False)
check('repeated term', solve({'a':[N,N+2]}, [['a',0],['a',2]]), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
retained holeFalseTrueFailed
adjacency is wrong for holeTrueFalseFailed
reversed orderFalseFalsePassed
later occurrenceFalseTrueFailed
missing termFalseFalsePassed
empty queryFalseFalsePassed
repeated termFalseTrueFailed

SHA-256 / 2363fcc1de1109d5853118c53c2641a3c546d8b2f7c5ab046207656fa7eab0b8

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(postings, query):
    return bool(query) and bool(set.intersection(*(set(v-p for v in postings.get(t,[])) for t,p in query)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retained hole', solve({'a':[N],'b':[N+2]}, [['a',0],['b',2]]), True)
check('adjacency is wrong for hole', solve({'a':[N],'b':[N+1]}, [['a',0],['b',2]]), False)
check('reversed order', solve({'a':[N+2],'b':[N]}, [['a',0],['b',2]]), False)
check('later occurrence', solve({'a':[0,N+3],'b':[N+5]}, [['a',0],['b',2]]), True)
check('missing term', solve({'a':[N]}, [['a',0],['b',2]]), False)
check('empty query', solve({}, []), False)
check('repeated term', solve({'a':[N,N+2]}, [['a',0],['a',2]]), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
retained holeTrueTruePassed
adjacency is wrong for holeFalseFalsePassed
reversed orderFalseFalsePassed
later occurrenceTrueTruePassed
missing termFalseFalsePassed
empty queryFalseFalsePassed
repeated termTrueTruePassed

SHA-256 / 3cf6c95e74f787d185c634b48209c103a12c95a7066925060f322db9798fc11e

Verification & scope

Inputs are already tokenized or scored; this model makes no claim about production engine performance or linguistic analysis. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:51.506104+00:00.

Case digest / 72ca7f60595b9bebd8c49e582b8b6927f0b265fbbeabc19fc8f24fa5137b8f80