Search — Filters & mode
Vector search answers "closest to my query." Two knobs widen its reach: the
mode parameter (semantic vs keyword vs hybrid) and — for predicate-based
narrowing — the query() primitive that pairs naturally with search.
The three modes
| Mode | When to use | Behavior |
|---|---|---|
semantic | Natural-language queries, discovery, chat grounding | Pure vector similarity |
keyword | Exact tokens matter: SKUs, slugs, brand names | Full-text scoring only |
hybrid | Mixed intent: "nike running shoes", "react hooks tutorial" | Blends both scores |
Mode is a per-call choice — pass mode: 'keyword' | 'hybrid' on the
request, or reach for the sugar methods beam.<lens>.searchKeyword(...)
and beam.<lens>.searchHybrid(...). Default is semantic.
Narrowing with a predicate pre-query
Need to restrict candidates to "footwear that's in stock" before ranking?
Run a query() on the same lens to get matching IDs, then filter search
results client-side.
A single-call where predicate inside search() is on the roadmap — for
now combine query() + search(), or narrow via a joined lens using
include: { relationName: { where: ... } }.