OLD | NEW |
1 # 2010 January 07 | 1 # 2010 January 07 |
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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 WHERE t2 MATCH 'one OR (four AND six)' | 513 WHERE t2 MATCH 'one OR (four AND six)' |
514 ORDER BY docid DESC | 514 ORDER BY docid DESC |
515 } { | 515 } { |
516 {five [one] two three [four]} | 516 {five [one] two three [four]} |
517 {[four] five [one] two three} | 517 {[four] five [one] two three} |
518 {three [four] five [one] two} | 518 {three [four] five [one] two} |
519 {two three [four] five [one]} | 519 {two three [four] five [one]} |
520 {[one] two three [four] five} | 520 {[one] two three [four] five} |
521 } | 521 } |
522 | 522 |
| 523 #------------------------------------------------------------------------- |
| 524 do_execsql_test 3 { |
| 525 CREATE VIRTUAL TABLE t3 USING fts4; |
| 526 INSERT INTO t3 VALUES('[one two three]'); |
| 527 } |
| 528 do_execsql_test 3.1 { |
| 529 SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'one'; |
| 530 } {{[<b>one</b> two three]}} |
| 531 do_execsql_test 3.2 { |
| 532 SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'two'; |
| 533 } {{[one <b>two</b> three]}} |
| 534 do_execsql_test 3.3 { |
| 535 SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'three'; |
| 536 } {{[one two <b>three</b>]}} |
| 537 do_execsql_test 3.4 { |
| 538 SELECT snippet(t3) FROM t3 WHERE t3 MATCH 'one OR two OR three'; |
| 539 } {{[<b>one</b> <b>two</b> <b>three</b>]}} |
| 540 |
| 541 #------------------------------------------------------------------------- |
| 542 # Request a snippet 0 tokens in size. This is always an empty string. |
| 543 do_execsql_test 4.1 { |
| 544 CREATE VIRTUAL TABLE t4 USING fts4; |
| 545 INSERT INTO t4 VALUES('a b c d'); |
| 546 SELECT snippet(t4, '[', ']', '...', 0, 0) FROM t4 WHERE t4 MATCH 'b'; |
| 547 } {{}} |
| 548 |
| 549 do_test 4.2 { |
| 550 set x35 [string trim [string repeat "x " 35]] |
| 551 execsql "INSERT INTO t4 VALUES('$x35 E $x35 F $x35 G $x35');" |
| 552 llength [db one { |
| 553 SELECT snippet(t4, '', '', '', 0, 64) FROM t4 WHERE t4 MATCH 'E' |
| 554 }] |
| 555 } {64} |
| 556 |
| 557 |
| 558 |
| 559 |
523 set sqlite_fts3_enable_parentheses 0 | 560 set sqlite_fts3_enable_parentheses 0 |
524 finish_test | 561 finish_test |
| 562 |
OLD | NEW |