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 '',
6 updated_at INTEGER NOT NULL DEFAULT (unixepoch())
7);
8
9CREATE INDEX IF NOT EXISTS idx_actors_handle ON actors(handle COLLATE NOCASE);
10
11CREATE VIRTUAL TABLE IF NOT EXISTS actors_fts USING fts5(
12 handle, display_name,
13 content='actors', content_rowid='rowid',
14 tokenize='unicode61 remove_diacritics 2'
15);
16
17-- keep FTS5 in sync via triggers
18CREATE TRIGGER IF NOT EXISTS actors_ai AFTER INSERT ON actors BEGIN
19 INSERT INTO actors_fts(rowid, handle, display_name)
20 VALUES (new.rowid, new.handle, new.display_name);
21END;
22
23CREATE TRIGGER IF NOT EXISTS actors_ad AFTER DELETE ON actors BEGIN
24 INSERT INTO actors_fts(actors_fts, rowid, handle, display_name)
25 VALUES ('delete', old.rowid, old.handle, old.display_name);
26END;
27
28CREATE TRIGGER IF NOT EXISTS actors_au AFTER UPDATE ON actors BEGIN
29 INSERT INTO actors_fts(actors_fts, rowid, handle, display_name)
30 VALUES ('delete', old.rowid, old.handle, old.display_name);
31 INSERT INTO actors_fts(rowid, handle, display_name)
32 VALUES (new.rowid, new.handle, new.display_name);
33END;
34
35CREATE TABLE IF NOT EXISTS metrics (
36 hour INTEGER PRIMARY KEY,
37 searches INTEGER NOT NULL DEFAULT 0,
38 total_ms REAL NOT NULL DEFAULT 0
39);
40
41CREATE TABLE IF NOT EXISTS snapshots (
42 hour INTEGER PRIMARY KEY,
43 total INTEGER NOT NULL DEFAULT 0,
44 with_handles INTEGER NOT NULL DEFAULT 0,
45 with_avatars INTEGER NOT NULL DEFAULT 0
46);