What text search forbids
You cannot simultaneously have exact global top-k ordering, sub-second visibility, an arbitrary scoring function, and exact faceting at low cost. Each pair is fine; the set is not. Specifically:
- order costs positions proportional to tokens;
- a non-decomposable score costs all skipping;
- facets cost a forward copy and cancel top-k pruning;
- freshness costs segment count, and therefore per-query fixed work;
- global score statistics cost a coordination round.
The escapes and their prices
| Escape | What it buys | Price |
|---|---|---|
| Multi-stage retrieval | makes an arbitrary scoring function affordable by confining it to a few hundred candidates | a hard recall ceiling set by the cheap stage, and a tuning surface with no closed form |
| Precomputation (n-grams, materialized facet aggregates, multiple analyzed fields) | converts read work into write work and space | vocabulary or index-size blow-up |
| Approximation of facet counts | buys facet aggregation back | two-sided error, licensed only because facet counts are advisory (the candidate-generation approximations in search are one-sided by necessity) |
| Local IDF | buys away a coordination round | silent, unmeasurable score inconsistency |