Loading articleโฆ
Loading 4weirdโฆ
Loading 4weirdโฆ
Loading articleโฆ
DocsSearch
Docs ยท search
Site search pairs a zero-cost static keyword index (built at deploy time, searched on-device) with an optional Luna AI rerank for intent and typos. Press Ctrl/โ+K anywhere, or share a link to /search?q=.
How search works
Every keystroke searches a static index (public/search/index.json plus lazy shards) on-device: tokenize, weighted rank โ title ร5, tags ร3, quick ร2, detail ร1 โ typo-tolerant prefix match, top-N with scores. No network, no cost, works offline. The Luna AI pass is opt-in per query: it reads intent and re-ranks the top-20 keyword hits.
search โ โneon racerโ
instant + LunaFor makers
Search only finds what entries declare. The planned tag rules (sibling DS-SEARCH-06) derive tags per kind and let any page override them in a registry: games carry genre + tags + age rating, docs carry section + keywords, music carries mood + instruments, servers carry dimension + band.
content/games.ts directly, so a game with tags: ["Racing", "Arcade"] answers both queries. Keep tags short, lowercase-friendly, player words.studio, music, search) plus 3โ5 keywords in frontmatter. This page, for example, answers โsearchโ, โlunaโ, โkeywordโ, and โbot apiโ.node scripts/build-search-index.mjs then node scripts/verify-search.mjs: the gate fails if any content/games.ts slug is missing from the index, and warns while sibling routes are still in flight.Bot API
Bots hit the same planned endpoint the overlay uses. GET is the instant keyword pass; POST adds the Luna rerank. Both are rate-limited per IP, and Luna answers are cached for 60 seconds. When Luna is unconfigured or down, the endpoint fails OPEN to keyword results โ never an error.
terminal โ bot search examples
curlcurl "https://4weird.com/api/search?q=neon+racer"
curl -X POST https://4weird.com/api/search \
-H 'Content-Type: application/json' \
-d '{"q":"neon racer","luna":true}'
Cost
Keyword search costs nothing: it runs against a static file, on-device, with zero backend calls. Luna only spends when a query opts into the AI pass โ and then the 60-second cache, per-IP rate limit, and top-20 rerank cap keep it bounded. Keys stay server-side: the verifier fails the build if a Luna key ever appears in the client overlay bundle.