FAILURE MAP
← Case archive

FA-11861 / Search retrieval semantics / Open access

Posting frequency is mistaken for document frequency · case 01

Posting frequency is mistaken for document frequency.

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

ROOT CAUSE

Repeated occurrences of a term inflate the count used by rarity scoring.

VERIFIED REPAIR

Count each document once when it contains the term.

Unsuccessful approach: Counting only documents where the term occurs once discards repeated-term documents.

Case contract

Return the number of tokenized documents containing the query term, including documents with repeated occurrences exactly once.

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(documents, term):
    return sum(doc.count(term) for doc in documents)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
t='term'+str(N)
check('repeated document', solve([[t]*(N+2)],t),1)
check('mixed documents', solve([[t,t],[t],[]],t),2)
check('absent corpus', solve([],t),0)
check('absent term', solve([['other'],[]],t),0)
check('two singleton documents', solve([[t],[t]],t),2)
check('empty document', solve([[]],t),0)
check('long unrelated document', solve([['x']*N+[t]],t),1)
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
repeated document31Failed
mixed documents32Failed
absent corpus00Passed
absent term00Passed
two singleton documents22Passed
empty document00Passed
long unrelated document11Passed

SHA-256 / df3af531dc68356a61b3bb9c892ebc95d41d0ee5a278e134c57ca0ea9b514cb7

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(documents, term):
    return sum(doc.count(term)==1 for doc in documents)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
t='term'+str(N)
check('repeated document', solve([[t]*(N+2)],t),1)
check('mixed documents', solve([[t,t],[t],[]],t),2)
check('absent corpus', solve([],t),0)
check('absent term', solve([['other'],[]],t),0)
check('two singleton documents', solve([[t],[t]],t),2)
check('empty document', solve([[]],t),0)
check('long unrelated document', solve([['x']*N+[t]],t),1)
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
repeated document01Failed
mixed documents12Failed
absent corpus00Passed
absent term00Passed
two singleton documents22Passed
empty document00Passed
long unrelated document11Passed

SHA-256 / c468af1c867f83aff75053e9f2cfacd30ebe1f2b769aa454ff501ee0c23fbeba

3 / The verified repair

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

N = 1
observations = []
def solve(documents, term):
    return sum(term in doc for doc in documents)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
t='term'+str(N)
check('repeated document', solve([[t]*(N+2)],t),1)
check('mixed documents', solve([[t,t],[t],[]],t),2)
check('absent corpus', solve([],t),0)
check('absent term', solve([['other'],[]],t),0)
check('two singleton documents', solve([[t],[t]],t),2)
check('empty document', solve([[]],t),0)
check('long unrelated document', solve([['x']*N+[t]],t),1)
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
repeated document11Passed
mixed documents22Passed
absent corpus00Passed
absent term00Passed
two singleton documents22Passed
empty document00Passed
long unrelated document11Passed

SHA-256 / 0ecd984e05cd8aa6a24dfb3137abfa38c007030284f107c3250938e3cefa476f

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.698346+00:00.

Case digest / bc5231f0e3ae26e4d8428a14df3be3e75544d1a077f073d2aeba2cc8a184b762