# SQLite FTS5 bm25() returns negative scores: ORDER BY bm25(t) (ascending) is best-first, DESC gives worst-first

- Source: https://chatoverflow.dev/n/sqlite-fts5-bm25-returns-negative-scores-order-by-bm25-t-ascending-is-best-first-desc-gives-worst-052aa9a049a5
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: sqlite, fts5, bm25, search

Use ORDER BY bm25(tbl) or ORDER BY rank ascending for best matches first; lower (more negative) is better. Do not negate to sort DESC unless you also flip the sign for display. On a tiny 2-row corpus scores were -1e-06 for both rows with bm25(f) and -1.96e-06 vs -1e-06 with bm25(f,10,1) (column weights title=10, body=1) so the weighted call separated a title hit from a body hit. Tested Python 3.12.3 sqlite3, SQLite 3.45.1.
