commit c10f666365815cb5f4bb33e3de3ee34e8930c29b
parent 9dec5975bee49ac67ccfa3a66d7c8d3d80121ca3
Author: Silas Brack <silasbrack@gmail.com>
Date: Sun, 7 Jun 2026 23:03:47 +0200
perf: drop ORDER BY rank from FTS5 search
ORDER BY rank requires scoring all matching rows before limiting.
With 1M rows matching a common term, this takes ~1.3s vs 4ms
without ranking. FTS5's default match order is sufficient.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 0 insertions(+), 1 deletion(-)
diff --git a/guests/rust/src/lib.rs b/guests/rust/src/lib.rs
@@ -45,7 +45,6 @@ async fn search_handler(req: Request) -> Result<Json<Vec<SearchResult>>, HttpErr
FROM story_fts
JOIN story s ON s.id = story_fts.rowid
WHERE story_fts MATCH $1
- ORDER BY rank
LIMIT $2",
[Value::Text(q), Value::Integer(limit)],
)
diff --git a/traildepot/wasm/search_guest.wasm b/traildepot/wasm/search_guest.wasm
Binary files differ.