Notebook diagram: query shapes routing to retrieval modes — exact, prefix, full-text, fuzzy, semantic, geospatial, hybrid — with their index families Search Systems & Retrieval

Search Modes: Choosing Exact, Full-Text, Semantic, Fuzzy, and Geospatial Retrieval

Core Concept

"Search" is not one algorithm — it is a contract between query intent and an index. Exact lookup asks whether a normalized field equals a value; full-text scores documents from an inverted index; semantic retrieval compares learned representations; geospatial retrieval evaluates distance, containment, or intersection. The shape of the query chooses the retrieval contract before ranking begins. Pick the contract first, then rank inside it.

Key Components

EXACT + PREFIX

The Hard Constraints

Hash tables, B-trees, tries. SKU AB-1042 wants exact lookup — semantic similarity may return a related but wrong product. Typing "nik" wants prefix completion over a term dictionary, not document ranking. These stay hard filters, never soft relevance.
FULL-TEXT + FUZZY

Words, Ranked and Misspelled

Inverted index ranked by BM25. "waterproof trail shoe" wants attribute + meaning. A misspelling wants edit/phonetic distance (Levenshtein automata, n-grams) — but a short fuzzy query can explode into too many expensive candidates.
SEMANTIC

Meaning Without the Words

Embeddings + approximate-nearest-neighbour indexes (HNSW, IVF). Finds "cozy cabin for two" without those words — but can miss identifiers, negation, rare names, and exact constraints. Meaning-based retrieval is not defined exclusively by vectors.
GEOSPATIAL + HYBRID

Where, and Both at Once

R-trees, geohashes, S2/H3 cells. "coffee within 2 km" needs the spatial predicate before text relevance. Hybrid is an orchestration strategy — fuse retrievers with normalized weighted sums or reciprocal-rank fusion, not raw score addition.

How It Works — The Decision Trace

Parse intent and hard filters first. Tenant, permissions, SKU, date, geography must remain hard constraints — not relevance hints a model can trade away.
Retrieve candidates with the smallest appropriate set of engines. Don't run all eight modes on every query; the query shape names the contract.
Fuse or rerank. BM25 and vector similarity live on different scales: weighted sums require normalization; reciprocal-rank fusion avoids scale assumptions but discards score magnitude.
Log which retrievers contributed each candidate — so poor results are attributed, not guessed at.

Failure Boundaries

Stemming can collapse distinct terms. Fuzzy can turn a short query into an expensive candidate set. Semantic can miss identifiers, negation, rare names. Geospatial bounding boxes include points outside the desired circle. And hybrid search does not become correct merely by combining two scores. If one universal retriever "wins" only by violating exact constraints or returning plausible-but-wrong identifiers, it is not a universal search engine — it is the wrong contract hidden behind a relevance score.

Real-World Applications

E-commerce product search (SKU + meaning) Search-box autocomplete (prefix + popularity + typos) Maps: "coffee near me" Log & document search for support teams Catalogs where a wrong identifier is a failure

Checkpoint — answer before you move on

  1. Why must SKU, tenant, and geography constraints stay hard filters rather than soft relevance hints — and what breaks if you let semantic scoring rank them? Think: a related-but-wrong product, and a permission leak.
  2. BM25 scores and vector similarities live on different scales. What must you do before adding them as a weighted sum — and what does reciprocal-rank fusion give up in exchange? Normalizing buys a common scale; RRF buys simplicity, loses magnitude.
  3. The falsification drill: before building search, write eight adversarial queries — exact identifier, partial prefix, misspelling, quoted phrase, synonym, negation, location radius, mixed lexical-semantic intent — and record which mode should own each. What does it mean if one retriever wins all eight? A win on exact constraints by a fuzzy engine is a red flag, not a trophy.