Platform Updates

Lexicon Search Overhaul: Faster, Fuzzier, Harder to Stump

Trigram indexing and relevance tuning for rule lookups

Dave April 23, 2026 2 min read

You should not leave the session tab to Google whether grappled creatures have zero speed. Our lexicon search upgrade makes in-app lookup the fastest path — with typo tolerance, better ranking, and performance tested against thousand-entry corpora.

What changed under the hood

We added PostgreSQL trigram indexes on entry titles and searchable text fields. Queries that once scanned full tables now hit indexed paths. Migration scripts live at db:apply-lexicon-search for self-hosted deployments; staging Neon already applied the change.

Ranking weighs exact title matches highest, then prefix matches, then body hits. Monster names with common words ("guard," "captain") rank by match position and entry type filters when you search from typed routes.

Global search integration

Ctrl+K (or Cmd+K) opens the command palette from most authenticated pages. Lexicon results appear alongside navigation targets — "Fireball" jumps to the spell page; "Characters" jumps to your roster. Session room includes a compact lexicon drawer for mid-combat lookup.

AI tool usage

The AI DM's lookupLexiconEntry tool calls the same backend search. When a player asks about a condition or spell, the model fetches authoritative text instead of inventing mechanics. This reduces the "actually in 5e it works like…" corrections mid-session.

Verification

We ship a db:verify-lexicon-search script that benchmarks p95 latency against thresholds. CI can run it when DATABASE_URL is available. Targets are sub-200ms for typical queries on Neon HTTP driver — your region may differ.

Search is not semantic yet — "spell that creates wall of fire" may not find Wall of Fire if you never type the name. Use keywords from the SRD for now.

Lexicon search overhaul is live for all users. Battle maps and fog of war follow in May.

Dave