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 #*************************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this script is testing the content=xxx FTS4 option.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set ::testprefix fts4content
19 # If SQLITE_ENABLE_FTS3 is defined, omit this file.
25 #-------------------------------------------------------------------------
28 # 1.* - Warm-body tests.
30 # 2.* - Querying a content=xxx FTS table.
32 # 3.* - Writing to a content=xxx FTS table.
34 # 4.* - The "INSERT INTO fts(fts) VALUES('rebuild')" command.
36 # 5.* - Check that CREATE TABLE, DROP TABLE and ALTER TABLE correctly
37 # ignore any %_content table when used with the content=xxx option.
39 # 6.* - Test the effects of messing with the schema of table xxx after
40 # creating a content=xxx FTS index.
42 # 7.* - Test that if content=xxx is specified and table xxx does not
43 # exist, the FTS table can still be used for INSERT and some
46 # 8.* - Test that if the content=xxx and prefix options are used together,
47 # the 'rebuild' command still works.
49 # 9.* - Test using content=xxx where xxx is a virtual table.
52 do_execsql_test 1.1.1 {
53 CREATE TABLE t1(a, b, c);
54 INSERT INTO t1 VALUES('w x', 'x y', 'y z');
55 CREATE VIRTUAL TABLE ft1 USING fts4(content=t1);
58 do_execsql_test 1.1.2 {
59 PRAGMA table_info(ft1);
66 do_execsql_test 1.1.3 { SELECT *, rowid FROM ft1 } {{w x} {x y} {y z} 1}
67 do_execsql_test 1.1.4 { SELECT a, c FROM ft1 WHERE rowid=1 } {{w x} {y z}}
69 do_execsql_test 1.1.5 { INSERT INTO ft1(ft1) VALUES('rebuild') } {}
70 do_execsql_test 1.1.6 { SELECT rowid FROM ft1 WHERE ft1 MATCH 'x' } {1}
71 do_execsql_test 1.1.7 { SELECT rowid FROM ft1 WHERE ft1 MATCH 'a' } {}
73 do_execsql_test 1.2.1 {
75 CREATE VIRTUAL TABLE ft1 USING fts4(content=t1, b);
76 PRAGMA table_info(ft1);
80 do_execsql_test 1.2.2 {
81 SELECT *, rowid FROM ft1
84 #-------------------------------------------------------------------------
85 # The following block of tests - 2.* - test that a content=xxx FTS table
86 # can be queried. Also tested are cases where rows identified in the FTS
87 # are missing from the content table, and cases where the index is
88 # inconsistent with the content table.
92 INSERT INTO t2 VALUES('O S W W F U C R Q I C N P Z Y Y E Y Y E'); -- 1
93 INSERT INTO t2 VALUES('Y X U V L B E H Y J C Y A I A P V F V K'); -- 2
94 INSERT INTO t2 VALUES('P W I N J H I I N I F B K D U Q B Z S F'); -- 3
95 INSERT INTO t2 VALUES('N R O R H J R H G M D I U U B O M P A U'); -- 4
96 INSERT INTO t2 VALUES('Y O V O G T P N G T N F I V B U M J M G'); -- 5
97 INSERT INTO t2 VALUES('J O B N K N E C H Z R K J O U G M K L S'); -- 6
98 INSERT INTO t2 VALUES('S Z S R I Q U A P W R X H K C Z U L S P'); -- 7
99 INSERT INTO t2 VALUES('J C H N R C K R V N M O F Z M Z A I H W'); -- 8
100 INSERT INTO t2 VALUES('O Y G I S J U U W O D Z F J K N R P R L'); -- 9
101 INSERT INTO t2 VALUES('B G L K U R U P V X Z I H V R W C Q A S'); -- 10
102 INSERT INTO t2 VALUES('T F T J F F Y V F W N X K Q A Y L X W G'); -- 11
103 INSERT INTO t2 VALUES('C J U H B Q X L C M M Y E G V F W V Z C'); -- 12
104 INSERT INTO t2 VALUES('B W L T F S G X D P H N G M R I O A X I'); -- 13
105 INSERT INTO t2 VALUES('N G Y O K Q K Z N M H U J E D H U W R K'); -- 14
106 INSERT INTO t2 VALUES('U D T R U Y F J D S J X E H Q G V A S Z'); -- 15
107 INSERT INTO t2 VALUES('M I W P J S H R J D Q I C G P C T P H R'); -- 16
108 INSERT INTO t2 VALUES('J M N I S L X Q C A B F C B Y D H V R J'); -- 17
109 INSERT INTO t2 VALUES('F V Z W J Q L P X Y E W B U Q N H X K T'); -- 18
110 INSERT INTO t2 VALUES('R F S R Y O F Q E I E G H C B H R X Y N'); -- 19
111 INSERT INTO t2 VALUES('U Q Q Q T E P D M F X P J G H X C Q D L'); -- 20
114 do_execsql_test 2.1 {
115 CREATE VIRTUAL TABLE ft2 USING fts4(content=t2);
116 INSERT INTO ft2(ft2) VALUES('rebuild');
118 -- Modify the backing table a bit: Row 17 is missing and the contents
119 -- of row 20 do not match the FTS index contents.
120 DELETE FROM t2 WHERE rowid = 17;
121 UPDATE t2 SET x = 'a b c d e f g h i j' WHERE rowid = 20;
124 foreach {tn match rowidlist} {
125 1 {S} {1 3 6 7 9 10 13 15 16 17 19}
131 do_execsql_test 2.2.1.$tn {
132 SELECT rowid FROM ft2 WHERE ft2 MATCH $match
135 do_execsql_test 2.2.2.$tn {
136 SELECT docid FROM ft2 WHERE ft2 MATCH $match
140 foreach {tn match result} {
141 1 {"N K N"} {{J O B N K N E C H Z R K J O U G M K L S}}
142 2 {"Q Q"} {{a b c d e f g h i j}}
145 do_execsql_test 2.3.$tn {
146 SELECT * FROM ft2 WHERE ft2 MATCH $match
150 foreach {tn match result} {
151 1 {"N K N"} {{..O B [N] [K] [N] E..}}
153 3 {"Q Q"} {{a [b] [c] [d] e f..}}
155 do_execsql_test 2.4.$tn {
156 SELECT snippet(ft2, '[', ']', '..', -1, 6) FROM ft2 WHERE ft2 MATCH $match
160 foreach {tn match result} {
161 1 {"N K N"} {{0 0 6 1 0 1 8 1 0 2 10 1}}
163 3 {"Q Q"} {{0 0 2 1 0 0 4 1 0 1 4 1 0 1 6 1}}
166 do_execsql_test 2.5.$tn {
167 SELECT offsets(ft2) FROM ft2 WHERE ft2 MATCH $match
171 #-------------------------------------------------------------------------
172 # The following block of tests - 3.* - test that the FTS index can be
173 # modified by writing to the table. But that this has no effect on the
177 do_execsql_test 3.1 {
178 CREATE TABLE t3(x, y);
179 CREATE VIRTUAL TABLE ft3 USING fts4(content=t3);
182 do_catchsql_test 3.1.1 {
183 INSERT INTO ft3 VALUES('a b c', 'd e f');
184 } {1 {constraint failed}}
185 do_execsql_test 3.1.2 {
186 INSERT INTO ft3(docid, x, y) VALUES(21, 'a b c', 'd e f');
187 SELECT rowid FROM ft3 WHERE ft3 MATCH '"a b c"';
189 do_execsql_test 3.1.3 { SELECT * FROM t3 } {}
191 # This DELETE does not work, since there is no row in [t3] to base the
192 # DELETE on. So the SELECT on [ft3] still returns rowid 21.
193 do_execsql_test 3.1.4 {
195 SELECT rowid FROM ft3 WHERE ft3 MATCH '"a b c"';
198 # If the row is added to [t3] before the DELETE on [ft3], it works.
199 do_execsql_test 3.1.5 {
200 INSERT INTO t3(rowid, x, y) VALUES(21, 'a b c', 'd e f');
202 SELECT rowid FROM ft3 WHERE ft3 MATCH '"a b c"';
204 do_execsql_test 3.1.6 { SELECT rowid FROM t3 } {21}
206 do_execsql_test 3.2.1 {
207 INSERT INTO ft3(rowid, x, y) VALUES(0, 'R T M S M', 'A F O K H');
208 INSERT INTO ft3(rowid, x, y) VALUES(1, 'C Z J O X', 'U S Q D K');
209 INSERT INTO ft3(rowid, x, y) VALUES(2, 'N G H P O', 'N O P O C');
210 INSERT INTO ft3(rowid, x, y) VALUES(3, 'V H S D R', 'K N G E C');
211 INSERT INTO ft3(rowid, x, y) VALUES(4, 'J T R V U', 'U X S L C');
212 INSERT INTO ft3(rowid, x, y) VALUES(5, 'N A Y N G', 'X D G P Y');
213 INSERT INTO ft3(rowid, x, y) VALUES(6, 'I Q I S P', 'D R O Q B');
214 INSERT INTO ft3(rowid, x, y) VALUES(7, 'T K T Z J', 'B W D G O');
215 INSERT INTO ft3(rowid, x, y) VALUES(8, 'Y K F X T', 'D F G V G');
216 INSERT INTO ft3(rowid, x, y) VALUES(9, 'E L E T L', 'P W N F Z');
217 INSERT INTO ft3(rowid, x, y) VALUES(10, 'O G J G X', 'G J F E P');
218 INSERT INTO ft3(rowid, x, y) VALUES(11, 'O L N N Z', 'K E Z F D');
219 INSERT INTO ft3(rowid, x, y) VALUES(12, 'R Z M R J', 'X G I M Z');
220 INSERT INTO ft3(rowid, x, y) VALUES(13, 'L X N N X', 'R R N S T');
221 INSERT INTO ft3(rowid, x, y) VALUES(14, 'F L B J H', 'K W F L C');
222 INSERT INTO ft3(rowid, x, y) VALUES(15, 'P E B M V', 'E A A B U');
223 INSERT INTO ft3(rowid, x, y) VALUES(16, 'V E C F P', 'L U T V K');
224 INSERT INTO ft3(rowid, x, y) VALUES(17, 'T N O Z N', 'T P Q X N');
225 INSERT INTO ft3(rowid, x, y) VALUES(18, 'V W U W R', 'H O A A V');
226 INSERT INTO ft3(rowid, x, y) VALUES(19, 'A H N L F', 'I G H B O');
229 foreach {tn match rowidlist} {
231 2 "x:O" {1 2 10 11 17}
232 3 "y:O" {0 2 6 7 18 19}
235 foreach rowid $rowidlist { lappend res $rowid {} {} }
237 do_execsql_test 3.2.2.$tn {
238 SELECT rowid, * FROM ft3 WHERE ft3 MATCH $match
240 do_execsql_test 3.2.3.$tn {
241 SELECT docid, * FROM ft3 WHERE ft3 MATCH $match
245 do_execsql_test 3.3.1 {
246 INSERT INTO t3(rowid, x, y) VALUES(0, 'R T M S M', 'A F O K H');
247 INSERT INTO t3(rowid, x, y) VALUES(1, 'C Z J O X', 'U S Q D K');
248 INSERT INTO t3(rowid, x, y) VALUES(2, 'N G H P O', 'N O P O C');
249 INSERT INTO t3(rowid, x, y) VALUES(3, 'V H S D R', 'K N G E C');
250 INSERT INTO t3(rowid, x, y) VALUES(4, 'J T R V U', 'U X S L C');
251 INSERT INTO t3(rowid, x, y) VALUES(5, 'N A Y N G', 'X D G P Y');
252 UPDATE ft3 SET x = y, y = x;
256 foreach {tn match rowidlist} {
258 2 "x:O" {0 2 10 11 17}
259 3 "y:O" {1 2 6 7 18 19}
262 foreach rowid $rowidlist { lappend res $rowid {} {} }
264 do_execsql_test 3.3.2.$tn {
265 SELECT rowid, * FROM ft3 WHERE ft3 MATCH $match
267 do_execsql_test 3.3.3.$tn {
268 SELECT docid, * FROM ft3 WHERE ft3 MATCH $match
272 do_execsql_test 3.3.1 {
273 INSERT INTO t3(rowid, x, y) VALUES(15, 'P E B M V', 'E A A B U');
274 INSERT INTO t3(rowid, x, y) VALUES(16, 'V E C F P', 'L U T V K');
275 INSERT INTO t3(rowid, x, y) VALUES(17, 'T N O Z N', 'T P Q X N');
276 INSERT INTO t3(rowid, x, y) VALUES(18, 'V W U W R', 'H O A A V');
277 INSERT INTO t3(rowid, x, y) VALUES(19, 'A H N L F', 'I G H B O');
281 foreach {tn match rowidlist} {
287 foreach rowid $rowidlist { lappend res $rowid {} {} }
289 do_execsql_test 3.3.2.$tn {
290 SELECT rowid, * FROM ft3 WHERE ft3 MATCH $match
292 do_execsql_test 3.3.3.$tn {
293 SELECT docid, * FROM ft3 WHERE ft3 MATCH $match
298 #-------------------------------------------------------------------------
299 # Test cases 4.* test the 'rebuild' command. On content=xxx and regular
302 do_execsql_test 4.0 {
304 CREATE VIRTUAL TABLE ft4 USING fts4(content=t4);
305 CREATE VIRTUAL TABLE ft4x USING fts4(x);
308 do_execsql_test 4.1.1 {
309 INSERT INTO ft4x(ft4x) VALUES('rebuild');
310 INSERT INTO ft4(ft4) VALUES('rebuild');
312 do_execsql_test 4.1.2 {
313 SELECT id, quote(value) FROM ft4_stat
315 do_execsql_test 4.1.3 {
316 SELECT id, quote(value) FROM ft4x_stat
319 do_execsql_test 4.2.1 {
320 INSERT INTO ft4x VALUES('M G M F T');
321 INSERT INTO ft4x VALUES('Z Q C A U');
322 INSERT INTO ft4x VALUES('N L L V');
323 INSERT INTO ft4x VALUES('T F D X D');
324 INSERT INTO ft4x VALUES('Z H I S D');
326 SELECT id, quote(value) FROM ft4x_stat
329 do_execsql_test 4.2.2 {
330 INSERT INTO ft4(rowid, x) SELECT rowid, * FROM ft4x;
331 SELECT id, quote(value) FROM ft4_stat
334 do_execsql_test 4.2.3 {
335 SELECT docid, quote(size) FROM ft4_docsize
336 } {1 X'05' 2 X'05' 3 X'04' 4 X'05' 5 X'05'}
338 do_execsql_test 4.2.4 {
339 INSERT INTO ft4x(ft4x) VALUES('rebuild');
340 SELECT id, quote(value) FROM ft4x_stat;
341 SELECT docid, quote(size) FROM ft4x_docsize
342 } {0 X'05182B' 1 X'05' 2 X'05' 3 X'04' 4 X'05' 5 X'05'}
344 do_execsql_test 4.2.5 {
345 INSERT INTO ft4(ft4) VALUES('rebuild');
346 SELECT id, quote(value) FROM ft4_stat;
347 SELECT docid, quote(size) FROM ft4_docsize
350 do_execsql_test 4.2.6 {
351 INSERT INTO t4(rowid, x) SELECT rowid, x FROM ft4x;
352 INSERT INTO ft4(ft4) VALUES('rebuild');
353 SELECT id, quote(value) FROM ft4_stat;
354 SELECT docid, quote(size) FROM ft4_docsize
355 } {0 X'05182B' 1 X'05' 2 X'05' 3 X'04' 4 X'05' 5 X'05'}
358 #-------------------------------------------------------------------------
359 # Test cases 5.* test that the following commands do not create/move or
360 # delete a %_content table when used with a content=xxx FTS table.
362 do_execsql_test 5.1.1 {
363 CREATE TABLE t5(a, b, c, d);
364 CREATE VIRTUAL TABLE ft5 USING fts4(content=t5);
365 SELECT name FROM sqlite_master WHERE name LIKE '%t5%';
367 t5 ft5 ft5_segments ft5_segdir
368 sqlite_autoindex_ft5_segdir_1 ft5_docsize ft5_stat
370 do_execsql_test 5.1.2 {
371 ALTER TABLE ft5 RENAME TO ft6;
372 SELECT name FROM sqlite_master WHERE name LIKE '%t5%';
376 do_execsql_test 5.1.3 {
377 SELECT name FROM sqlite_master WHERE name LIKE '%t6%';
379 ft6 ft6_segments ft6_segdir
380 sqlite_autoindex_ft6_segdir_1 ft6_docsize ft6_stat
382 do_execsql_test 5.1.4 {
383 INSERT INTO t5 VALUES('a', 'b', 'c', 'd');
384 INSERT INTO ft6(ft6) VALUES('rebuild');
385 SELECT rowid FROM ft6 WHERE ft6 MATCH 'b';
387 do_execsql_test 5.1.5 {
391 do_execsql_test 5.1.6 {
392 SELECT name FROM sqlite_master WHERE name LIKE '%t6%';
395 do_execsql_test 5.1.7 {
396 CREATE VIRTUAL TABLE ft5 USING fts4(content=t5);
397 CREATE TABLE t5_content(a, b);
399 SELECT name FROM sqlite_master WHERE name LIKE '%t5%';
404 #-------------------------------------------------------------------------
405 # Test cases 6.* test
407 do_catchsql_test 6.1.1 {
408 CREATE VIRTUAL TABLE ft7 USING fts4(content=t7);
409 } {1 {vtable constructor failed: ft7}}
411 do_execsql_test 6.2.1 {
412 CREATE TABLE t7(one, two);
413 CREATE VIRTUAL TABLE ft7 USING fts4(content=t7);
414 INSERT INTO t7 VALUES('A B', 'B A');
415 INSERT INTO t7 VALUES('C D', 'A A');
418 {A B} {B A} {C D} {A A}
421 do_catchsql_test 6.2.2 {
424 } {1 {SQL logic error or missing database}}
428 do_execsql_test 6.2.3 {
429 SELECT name FROM sqlite_master WHERE name LIKE '%t7%'
431 ft7 ft7_segments ft7_segdir sqlite_autoindex_ft7_segdir_1
434 do_catchsql_test 6.2.4 {
436 } {1 {vtable constructor failed: ft7}}
437 do_execsql_test 6.2.5 {
438 CREATE TABLE t7(x, y);
439 INSERT INTO t7 VALUES('A B', 'B A');
440 INSERT INTO t7 VALUES('C D', 'A A');
443 {A B} {B A} {C D} {A A}
446 do_execsql_test 6.2.6 {
447 INSERT INTO ft7(ft7) VALUES('rebuild');
448 SELECT rowid FROM ft7 WHERE ft7 MATCH '"A A"';
451 do_execsql_test 6.2.7 {
455 do_catchsql_test 6.2.8 {
456 SELECT * FROM ft7 WHERE ft7 MATCH '"A A"';
457 } {1 {SQL logic error or missing database}}
458 do_catchsql_test 6.2.9 {
459 SELECT * FROM ft7 WHERE ft7 MATCH '"A A"';
460 } {1 {SQL logic error or missing database}}
464 do_catchsql_test 6.2.10 {
465 SELECT rowid FROM ft7 WHERE ft7 MATCH '"A A"';
467 do_catchsql_test 6.2.11 {
468 SELECT rowid, * FROM ft7 WHERE ft7 MATCH '"A A"';
471 #-------------------------------------------------------------------------
474 do_execsql_test 7.1.1 {
475 CREATE VIRTUAL TABLE ft8 USING fts4(content=nosuchtable, x);
476 INSERT INTO ft8(docid, x) VALUES(13, 'U O N X G');
477 INSERT INTO ft8(docid, x) VALUES(14, 'C J J U B');
478 INSERT INTO ft8(docid, x) VALUES(15, 'N J Y G X');
479 INSERT INTO ft8(docid, x) VALUES(16, 'R Y D O R');
480 INSERT INTO ft8(docid, x) VALUES(17, 'I Y T Q O');
483 do_execsql_test 7.1.2 {
484 SELECT docid FROM ft8 WHERE ft8 MATCH 'N';
487 do_execsql_test 7.2.1 {
488 CREATE VIRTUAL TABLE ft9 USING fts4(content=, x);
489 INSERT INTO ft9(docid, x) VALUES(13, 'U O N X G');
490 INSERT INTO ft9(docid, x) VALUES(14, 'C J J U B');
491 INSERT INTO ft9(docid, x) VALUES(15, 'N J Y G X');
492 INSERT INTO ft9(docid, x) VALUES(16, 'R Y D O R');
493 INSERT INTO ft9(docid, x) VALUES(17, 'I Y T Q O');
495 do_execsql_test 7.2.2 {
496 SELECT docid FROM ft9 WHERE ft9 MATCH 'N';
498 do_execsql_test 7.2.3 {
499 SELECT name FROM sqlite_master WHERE name LIKE 'ft9_%';
500 } {ft9_segments ft9_segdir ft9_docsize ft9_stat}
502 do_catchsql_test 7.2.4 {
503 SELECT * FROM ft9 WHERE ft9 MATCH 'N';
504 } {1 {SQL logic error or missing database}}
506 #-------------------------------------------------------------------------
509 do_execsql_test 8.1 {
510 CREATE TABLE t10(a, b);
511 INSERT INTO t10 VALUES(
512 'abasia abasic abask', 'Abassin abastardize abatable');
513 INSERT INTO t10 VALUES(
514 'abate abatement abater', 'abatis abatised abaton');
515 INSERT INTO t10 VALUES(
516 'abator abattoir Abatua', 'abature abave abaxial');
518 CREATE VIRTUAL TABLE ft10 USING fts4(content=t10, prefix="2,4", a, b);
521 do_execsql_test 8.2 { SELECT * FROM ft10 WHERE a MATCH 'ab*'; }
522 do_execsql_test 8.3 { INSERT INTO ft10(ft10) VALUES('rebuild'); }
523 do_execsql_test 8.4 { SELECT rowid FROM ft10 WHERE a MATCH 'ab*'; } {1 2 3}
524 do_execsql_test 8.5 { SELECT rowid FROM ft10 WHERE b MATCH 'abav*'; } {3}
525 do_execsql_test 8.6 { SELECT rowid FROM ft10 WHERE ft10 MATCH 'abas*'; } {1}
527 #-------------------------------------------------------------------------
531 register_echo_module [sqlite3_connection_pointer db]
533 do_execsql_test 9.1 {
534 CREATE TABLE tbl1(a, b);
535 INSERT INTO tbl1 VALUES('a b', 'c d');
536 INSERT INTO tbl1 VALUES('e f', 'a b');
537 CREATE VIRTUAL TABLE e1 USING echo(tbl1);
538 CREATE VIRTUAL TABLE ft1 USING fts4(content=e1);
539 INSERT INTO ft1(ft1) VALUES('rebuild');
542 do_execsql_test 9.2 {
543 SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'e'
546 do_execsql_test 9.3 {
547 SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a'
548 } {1 {a b} {c d} 2 {e f} {a b}}
550 do_execsql_test 9.4 {
551 DELETE FROM ft1 WHERE docid=1;
554 do_execsql_test 9.5 {
555 SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a'
558 do_execsql_test 9.6 {
559 INSERT INTO ft1(ft1) VALUES('rebuild');
560 SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a'
561 } {1 {a b} {c d} 2 {e f} {a b}}
564 #-------------------------------------------------------------------------
568 register_fs_module [sqlite3_connection_pointer db]
570 proc write_file {path text} {
571 set fd [open $path w]
572 puts -nonewline $fd $text
576 write_file t1.txt {a b c d e f g h i j k l m n o p q r s t u v w x y z}
577 write_file t2.txt {a b c d e f g h i j k l m a b c d e f g h i j k l m}
578 write_file t3.txt {n o p q r s t u v w x y z n o p q r s t u v w x y z}
580 do_execsql_test 10.1 {
581 CREATE TABLE idx(id INTEGER PRIMARY KEY, path TEXT);
582 INSERT INTO idx VALUES (1, 't1.txt');
583 INSERT INTO idx VALUES (2, 't2.txt');
584 INSERT INTO idx VALUES (3, 't3.txt');
586 CREATE VIRTUAL TABLE vt USING fs(idx);
589 1 {a b c d e f g h i j k l m n o p q r s t u v w x y z}
590 2 {a b c d e f g h i j k l m a b c d e f g h i j k l m}
591 3 {n o p q r s t u v w x y z n o p q r s t u v w x y z}
594 do_execsql_test 10.2 {
595 SELECT * FROM vt WHERE rowid = 2;
597 2 {a b c d e f g h i j k l m a b c d e f g h i j k l m}
600 do_execsql_test 10.3 {
601 CREATE VIRTUAL TABLE ft USING fts4(content=vt);
602 INSERT INTO ft(ft) VALUES('rebuild');
605 do_execsql_test 10.4 {
606 SELECT snippet(ft, '[', ']', '...', -1, 5) FROM ft WHERE ft MATCH 'e'
608 {...c d [e] f g...} {...c d [e] f g...}
611 do_execsql_test 10.5 {
612 SELECT snippet(ft, '[', ']', '...', -1, 5) FROM ft WHERE ft MATCH 't'
614 {...r s [t] u v...} {...r s [t] u v...}
617 do_execsql_test 10.6 { DELETE FROM ft WHERE docid=2 }
619 do_execsql_test 10.7 {
620 SELECT snippet(ft, '[', ']', '...', -1, 5) FROM ft WHERE ft MATCH 'e'