3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
12 # Tests focused on phrase queries.
15 source [file join [file dirname [info script]] fts5_common.tcl]
16 set testprefix fts5origintext4
18 # If SQLITE_ENABLE_FTS5 is defined, omit this file.
24 # The tests below verify that a doclist-index is used to limit the number
25 # of pages loaded into the cache. It does this by querying sqlite3_db_status()
26 # for the amount of memory used by the pager cache.
28 # memsubsys1 effectively limits the page-cache to 24 pages. Which masks
29 # the effect tested by the tests in this file. And "mmap" prevents the
30 # cache from being used, also preventing these tests from working.
32 if {[permutation]=="memsubsys1" || [permutation]=="mmap"} {
37 sqlite3_fts5_register_origintext db
39 PRAGMA page_size = 4096;
40 CREATE VIRTUAL TABLE ft USING fts5(
41 x, tokenize="origintext unicode61", tokendata=1
47 INSERT INTO ft SELECT 'the first thing';
50 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<90000
52 INSERT INTO ft SELECT 'The second thing' FROM s;
54 INSERT INTO ft SELECT 'the first thing';
56 INSERT INTO ft(ft) VALUES('optimize');
59 foreach {tn sql expr} {
60 1 { SELECT rowid FROM ft('the') } {$mem > 250000}
61 2 { SELECT rowid FROM ft('first') } {$mem < 50000}
62 3 { SELECT rowid FROM ft('the first') } {$mem < 50000}
66 sqlite3_fts5_register_origintext db
70 set mem [lindex [sqlite3_db_status db CACHE_USED 0] 1]
75 proc b {x} { string map [list "\0" "."] $x }
77 # execsql_pp { SELECT segid, b(term), pgno from ft_idx }