OLD | NEW |
1 # 2010 October 23 | 1 # 2010 October 23 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # | 11 # |
12 | 12 |
13 set testdir [file dirname $argv0] | 13 set testdir [file dirname $argv0] |
14 source $testdir/tester.tcl | 14 source $testdir/tester.tcl |
15 source $testdir/malloc_common.tcl | 15 source $testdir/malloc_common.tcl |
16 ifcapable !fts3 { finish_test ; return } | 16 ifcapable !fts3||!fts4_deferred { |
| 17 finish_test |
| 18 return |
| 19 } |
17 | 20 |
18 set testprefix fts3defer2 | 21 set testprefix fts3defer2 |
19 | 22 |
20 proc mit {blob} { | 23 proc mit {blob} { |
21 set scan(littleEndian) i* | 24 set scan(littleEndian) i* |
22 set scan(bigEndian) I* | 25 set scan(bigEndian) I* |
23 binary scan $blob $scan($::tcl_platform(byteOrder)) r | 26 binary scan $blob $scan($::tcl_platform(byteOrder)) r |
24 return $r | 27 return $r |
25 } | 28 } |
26 db func mit mit | 29 db func mit mit |
(...skipping 14 matching lines...) Expand all Loading... |
41 INSERT INTO t1 VALUES(''); | 44 INSERT INTO t1 VALUES(''); |
42 INSERT INTO t1 VALUES(''); | 45 INSERT INTO t1 VALUES(''); |
43 INSERT INTO t1 VALUES(''); | 46 INSERT INTO t1 VALUES(''); |
44 INSERT INTO t1(t1) VALUES('optimize'); | 47 INSERT INTO t1(t1) VALUES('optimize'); |
45 } | 48 } |
46 do_execsql_test 1.1.4 { | 49 do_execsql_test 1.1.4 { |
47 SELECT count(*) FROM t1_segments WHERE length(block)>10000; | 50 SELECT count(*) FROM t1_segments WHERE length(block)>10000; |
48 UPDATE t1_segments SET block = zeroblob(length(block)) WHERE length(block)>100
00; | 51 UPDATE t1_segments SET block = zeroblob(length(block)) WHERE length(block)>100
00; |
49 } {2} | 52 } {2} |
50 | 53 |
| 54 do_execsql_test 1.2.0 { |
| 55 SELECT content FROM t1 WHERE t1 MATCH 'f (e a)'; |
| 56 } {{a b c d e f a x y}} |
| 57 |
51 do_execsql_test 1.2.1 { | 58 do_execsql_test 1.2.1 { |
52 SELECT content FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)'; | 59 SELECT content FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)'; |
53 } {{a b c d e f a x y}} | 60 } {{a b c d e f a x y}} |
54 | 61 |
| 62 |
55 do_execsql_test 1.2.2 { | 63 do_execsql_test 1.2.2 { |
56 SELECT snippet(t1, '[', ']'), offsets(t1), mit(matchinfo(t1, 'pcxnal')) | 64 SELECT snippet(t1, '[', ']'), offsets(t1), mit(matchinfo(t1, 'pcxnal')) |
57 FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)'; | 65 FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)'; |
58 } [list \ | 66 } [list \ |
59 {a b c d [e] [f] [a] x y} \ | 67 {a b c d [e] [f] [a] x y} \ |
60 {0 1 8 1 0 0 10 1 0 2 12 1} \ | 68 {0 1 8 1 0 0 10 1 0 2 12 1} \ |
61 [list 3 1 1 1 1 1 8 8 1 8 8 8 5001 9] | 69 [list 3 1 1 1 1 1 1 1 1 1 1 8 5001 9] |
62 ] | 70 ] |
63 | 71 |
64 do_execsql_test 1.2.3 { | 72 do_execsql_test 1.2.3 { |
65 SELECT snippet(t1, '[', ']'), offsets(t1), mit(matchinfo(t1, 'pcxnal')) | 73 SELECT snippet(t1, '[', ']'), offsets(t1), mit(matchinfo(t1, 'pcxnal')) |
66 FROM t1 WHERE t1 MATCH 'f (e NEAR/3 a)'; | 74 FROM t1 WHERE t1 MATCH 'f (e NEAR/3 a)'; |
67 } [list \ | 75 } [list \ |
68 {[a] b c d [e] [f] [a] x y} \ | 76 {[a] b c d [e] [f] [a] x y} \ |
69 {0 2 0 1 0 1 8 1 0 0 10 1 0 2 12 1} \ | 77 {0 2 0 1 0 1 8 1 0 0 10 1 0 2 12 1} \ |
70 [list 3 1 1 1 1 1 8 8 2 8 8 8 5001 9] | 78 [list 3 1 1 1 1 1 1 1 2 2 1 8 5001 9] |
71 ] | 79 ] |
72 | 80 |
73 do_execsql_test 1.3.1 { DROP TABLE t1 } | 81 do_execsql_test 1.3.1 { DROP TABLE t1 } |
74 | 82 |
75 #----------------------------------------------------------------------------- | 83 #----------------------------------------------------------------------------- |
76 # Test cases fts3defer2-2.* focus specifically on the matchinfo function. | 84 # Test cases fts3defer2-2.* focus specifically on the matchinfo function. |
77 # | 85 # |
78 do_execsql_test 2.1.1 "CREATE VIRTUAL TABLE t2 USING fts4" | 86 do_execsql_test 2.1.1 "CREATE VIRTUAL TABLE t2 USING fts4" |
79 do_execsql_test 2.1.2 "INSERT INTO t2 VALUES('[string repeat {a } 10000]')" | 87 do_execsql_test 2.1.2 "INSERT INTO t2 VALUES('[string repeat {a } 10000]')" |
80 do_execsql_test 2.1.3 "INSERT INTO t2 VALUES('b [string repeat {z } 10000]')" | 88 do_execsql_test 2.1.3 "INSERT INTO t2 VALUES('b [string repeat {z } 10000]')" |
(...skipping 11 matching lines...) Expand all Loading... |
92 } { | 100 } { |
93 execsql $sql | 101 execsql $sql |
94 | 102 |
95 do_execsql_test 2.2.$tn.1 { | 103 do_execsql_test 2.2.$tn.1 { |
96 SELECT mit(matchinfo(t2, 'pcxnal')) FROM t2 WHERE t2 MATCH 'a b'; | 104 SELECT mit(matchinfo(t2, 'pcxnal')) FROM t2 WHERE t2 MATCH 'a b'; |
97 } [list \ | 105 } [list \ |
98 [list 2 1 1 54 54 1 3 3 54 372 8] \ | 106 [list 2 1 1 54 54 1 3 3 54 372 8] \ |
99 [list 2 1 1 54 54 1 3 3 54 372 7] \ | 107 [list 2 1 1 54 54 1 3 3 54 372 7] \ |
100 ] | 108 ] |
101 | 109 |
| 110 do_execsql_test 2.2.$tn.2 { |
| 111 SELECT mit(matchinfo(t2, 'x')) FROM t2 WHERE t2 MATCH 'g z'; |
| 112 } [list \ |
| 113 [list 1 2 2 1 54 54] \ |
| 114 ] |
| 115 |
102 set sqlite_fts3_enable_parentheses 1 | 116 set sqlite_fts3_enable_parentheses 1 |
103 do_execsql_test 2.2.$tn.2 { | 117 do_execsql_test 2.2.$tn.3 { |
104 SELECT mit(matchinfo(t2, 'x')) FROM t2 WHERE t2 MATCH 'g OR (g z)'; | 118 SELECT mit(matchinfo(t2, 'x')) FROM t2 WHERE t2 MATCH 'g OR (g z)'; |
105 } [list \ | 119 } [list \ |
106 [list 1 2 2 1 2 2 1 54 54] \ | 120 [list 1 2 2 1 2 2 1 54 54] \ |
107 [list 1 2 2 1 2 2 0 54 54] \ | 121 [list 1 2 2 1 2 2 0 54 54] \ |
108 ] | 122 ] |
109 set sqlite_fts3_enable_parentheses 0 | 123 set sqlite_fts3_enable_parentheses 0 |
110 } | 124 } |
111 | 125 |
112 do_execsql_test 2.3.1 { | 126 do_execsql_test 2.3.1 { |
113 CREATE VIRTUAL TABLE t3 USING fts4; | 127 CREATE VIRTUAL TABLE t3 USING fts4; |
(...skipping 19 matching lines...) Expand all Loading... |
133 } | 147 } |
134 } { | 148 } { |
135 execsql $sql | 149 execsql $sql |
136 do_execsql_test 2.4.$tn { | 150 do_execsql_test 2.4.$tn { |
137 SELECT docid, mit(matchinfo(t3, 'pcxnal')) FROM t3 WHERE t3 MATCH '"a b c"'; | 151 SELECT docid, mit(matchinfo(t3, 'pcxnal')) FROM t3 WHERE t3 MATCH '"a b c"'; |
138 } {1 {1 1 1 4 4 11 912 6} 3 {1 1 1 4 4 11 912 6}} | 152 } {1 {1 1 1 4 4 11 912 6} 3 {1 1 1 4 4 11 912 6}} |
139 } | 153 } |
140 | 154 |
141 | 155 |
142 finish_test | 156 finish_test |
143 | |
OLD | NEW |