OLD | NEW |
1 # 2014 Dec 20 | 1 # 2014 Dec 20 |
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 #*********************************************************************** |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 tokenize="porter unicode61 separators ABCDEFGHIJKLMNOPQRSTUVWXYZ" | 255 tokenize="porter unicode61 separators ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
256 ); | 256 ); |
257 INSERT INTO e6 VALUES('theAquickBbrownCfoxDjumpedWoverXtheYlazyZdog'); | 257 INSERT INTO e6 VALUES('theAquickBbrownCfoxDjumpedWoverXtheYlazyZdog'); |
258 CREATE VIRTUAL TABLE e7 USING fts5vocab(e6, 'row'); | 258 CREATE VIRTUAL TABLE e7 USING fts5vocab(e6, 'row'); |
259 SELECT term FROM e7; | 259 SELECT term FROM e7; |
260 ROLLBACK; | 260 ROLLBACK; |
261 } { | 261 } { |
262 brown dog fox jump lazi over quick the | 262 brown dog fox jump lazi over quick the |
263 } | 263 } |
264 | 264 |
| 265 #------------------------------------------------------------------------- |
| 266 # Check that the FTS5_TOKENIZE_PREFIX flag is passed to the tokenizer |
| 267 # implementation. |
| 268 # |
| 269 reset_db |
| 270 proc tcl_create {args} { return "tcl_tokenize" } |
| 271 sqlite3_fts5_create_tokenizer db tcl tcl_create |
| 272 set ::flags [list] |
| 273 proc tcl_tokenize {tflags text} { |
| 274 lappend ::flags $tflags |
| 275 foreach {w iStart iEnd} [fts5_tokenize_split $text] { |
| 276 sqlite3_fts5_token $w $iStart $iEnd |
| 277 } |
| 278 } |
| 279 |
| 280 do_execsql_test 9.1.1 { |
| 281 CREATE VIRTUAL TABLE t1 USING fts5(a, tokenize=tcl); |
| 282 INSERT INTO t1 VALUES('abc'); |
| 283 INSERT INTO t1 VALUES('xyz'); |
| 284 } {} |
| 285 do_test 9.1.2 { set ::flags } {document document} |
| 286 |
| 287 set ::flags [list] |
| 288 do_execsql_test 9.2.1 { SELECT * FROM t1('abc'); } {abc} |
| 289 do_test 9.2.2 { set ::flags } {query} |
| 290 |
| 291 set ::flags [list] |
| 292 do_execsql_test 9.3.1 { SELECT * FROM t1('ab*'); } {abc} |
| 293 do_test 9.3.2 { set ::flags } {prefixquery} |
| 294 |
| 295 set ::flags [list] |
| 296 do_execsql_test 9.4.1 { SELECT * FROM t1('"abc xyz" *'); } {} |
| 297 do_test 9.4.2 { set ::flags } {prefixquery} |
| 298 |
| 299 set ::flags [list] |
| 300 do_execsql_test 9.5.1 { SELECT * FROM t1('"abc xyz*"'); } {} |
| 301 do_test 9.5.2 { set ::flags } {query} |
| 302 |
| 303 |
265 finish_test | 304 finish_test |
266 | 305 |
OLD | NEW |