GET /xrpc/app.bsky.actor.searchActorsTypeahead
typeahead.waow.tech
1CREATE TABLE IF NOT EXISTS actors (
2 did TEXT PRIMARY KEY,
3 handle TEXT NOT NULL DEFAULT '',
4 display_name TEXT DEFAULT '',
5 avatar_url TEXT DEFAULT '', -- stores CID only (e.g. bafkrei...); reconstruct URL at query time
6 updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
7 hidden INTEGER NOT NULL DEFAULT 0
8);
9
10CREATE INDEX IF NOT EXISTS idx_actors_handle ON actors(handle COLLATE NOCASE);
11
12CREATE VIRTUAL TABLE IF NOT EXISTS actors_fts USING fts5(
13 handle, display_name,
14 content='actors', content_rowid='rowid',
15 tokenize='unicode61 remove_diacritics 2'
16);
17
18-- keep FTS5 in sync via triggers
19CREATE TRIGGER IF NOT EXISTS actors_ai AFTER INSERT ON actors BEGIN
20 INSERT INTO actors_fts(rowid, handle, display_name)
21 VALUES (new.rowid, new.handle, new.display_name);
22END;
23
24CREATE TRIGGER IF NOT EXISTS actors_ad AFTER DELETE ON actors BEGIN
25 INSERT INTO actors_fts(actors_fts, rowid, handle, display_name)
26 VALUES ('delete', old.rowid, old.handle, old.display_name);
27END;
28
29CREATE TRIGGER IF NOT EXISTS actors_au AFTER UPDATE ON actors BEGIN
30 INSERT INTO actors_fts(actors_fts, rowid, handle, display_name)
31 VALUES ('delete', old.rowid, old.handle, old.display_name);
32 INSERT INTO actors_fts(rowid, handle, display_name)
33 VALUES (new.rowid, new.handle, new.display_name);
34END;
35
36CREATE TABLE IF NOT EXISTS metrics (
37 hour INTEGER PRIMARY KEY,
38 searches INTEGER NOT NULL DEFAULT 0,
39 total_ms REAL NOT NULL DEFAULT 0
40);
41
42CREATE TABLE IF NOT EXISTS snapshots (
43 hour INTEGER PRIMARY KEY,
44 total INTEGER NOT NULL DEFAULT 0,
45 with_handles INTEGER NOT NULL DEFAULT 0,
46 with_avatars INTEGER NOT NULL DEFAULT 0
47);