feat: full FTS BM25 integration — CREATE INDEX USING FTS, BM25 ranking on @@

- evalExpr accepts optional ExecutionContext for FTS index lookup
- CREATE INDEX ... USING FTS builds InvertedIndex from existing data
- @@ uses BM25 scoring when FTS index exists, falls back to term match
- INSERT/UPDATE/DELETE auto-maintain FTS indexes
- 283 tests, 0 failures
This commit is contained in:
2026-05-07 13:58:18 +03:00
parent b1aadf77f9
commit 32187099dd
4 changed files with 126 additions and 27 deletions
+14
View File
@@ -2467,5 +2467,19 @@ suite "Parameterized queries":
let r = qexec.executeQuery(ctx, parse("RECOVER TO TIMESTAMP '2026-12-31T23:59:59'"))
check r.success
test "FTS index creation USING FTS":
discard qexec.executeQuery(ctx, parse("CREATE TABLE IF NOT EXISTS fts_test (id INT PRIMARY KEY, body TEXT)"))
discard qexec.executeQuery(ctx, parse("INSERT INTO fts_test (id, body) VALUES (1, 'the quick brown fox jumps')"))
discard qexec.executeQuery(ctx, parse("INSERT INTO fts_test (id, body) VALUES (2, 'lazy dog sleeps all day')"))
discard qexec.executeQuery(ctx, parse("INSERT INTO fts_test (id, body) VALUES (3, 'quick brown dog plays fetch')"))
let r = qexec.executeQuery(ctx, parse("CREATE INDEX idx_fts_body ON fts_test(body) USING FTS"))
check r.success
check r.message.contains("USING FTS")
test "FTS index @@ uses BM25":
let r = qexec.executeQuery(ctx, parse("SELECT id FROM fts_test WHERE body @@ 'quick brown'"))
check r.success
check r.rows.len >= 2
# JOIN tests
include "join_tests"