mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
dup fts1 tests and edit for fts2. fts1porter.test omitted because it
depends on being able to poke through to %_term table. (CVS 3482) FossilOrigin-Name: 2806c3415841b98d52163fa672a747d0a47ffd41
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Add\stests\sfor\sdelete\sand\supdate\sin\sfts1.\s(CVS\s3481)
|
C dup\sfts1\stests\sand\sedit\sfor\sfts2.\s\sfts1porter.test\somitted\sbecause\sit\ndepends\son\sbeing\sable\sto\spoke\sthrough\sto\s%_term\stable.\s(CVS\s3482)
|
||||||
D 2006-10-19T23:28:35
|
D 2006-10-19T23:36:26
|
||||||
F Makefile.in 4379c909d46b38b8c5db3533084601621d4f14b2
|
F Makefile.in 4379c909d46b38b8c5db3533084601621d4f14b2
|
||||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@@ -206,6 +206,12 @@ F test/fts1d.test a73deace5c18df4a549b12908bade4f05dcf1a2f
|
|||||||
F test/fts1e.test 77244843e925560b5a0b70069c3e7ab62f181ed2
|
F test/fts1e.test 77244843e925560b5a0b70069c3e7ab62f181ed2
|
||||||
F test/fts1f.test cdab90834a7627a26fed2f75d2f451650fb31fad
|
F test/fts1f.test cdab90834a7627a26fed2f75d2f451650fb31fad
|
||||||
F test/fts1porter.test d86e9c3e0c7f8ff95add6582b4b585fb4e02b96d
|
F test/fts1porter.test d86e9c3e0c7f8ff95add6582b4b585fb4e02b96d
|
||||||
|
F test/fts2a.test 103fc178d134c54c44c1938a4331e9e2030792d9
|
||||||
|
F test/fts2b.test 964abc0236c849c07ca1ae496bb25c268ae94816
|
||||||
|
F test/fts2c.test ffb5a35230ac72c4354535c547965ce6824537c0
|
||||||
|
F test/fts2d.test b7eaa671ca9a16997f3e5b158ee777ae21052b0b
|
||||||
|
F test/fts2e.test 2da13dbc2d009105f42196845c1e1ce136c03d38
|
||||||
|
F test/fts2f.test b5f2dde48199d79e859f59d3d857c17dd62a0129
|
||||||
F test/func.test 0ed54b5aeaad319f68016c033acfebef56f5874a
|
F test/func.test 0ed54b5aeaad319f68016c033acfebef56f5874a
|
||||||
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
|
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
|
||||||
F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
|
F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
|
||||||
@@ -412,7 +418,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||||
P 004ad1943f8c5933ee9584a57b2de9d421470d3c
|
P b01c4371d861a087623a34c38cb8db74eca95348
|
||||||
R c1e87a25b098c32ca808ba399800175b
|
R c24a94afe5bc7f2d9a795aaefd9ab181
|
||||||
U shess
|
U shess
|
||||||
Z d2ba853bd32eca67e15216614c4bfedc
|
Z ebbb22449f830ff82b909fcef8d93031
|
||||||
|
@@ -1 +1 @@
|
|||||||
b01c4371d861a087623a34c38cb8db74eca95348
|
2806c3415841b98d52163fa672a747d0a47ffd41
|
186
test/fts2a.test
Normal file
186
test/fts2a.test
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
# 2006 September 9
|
||||||
|
#
|
||||||
|
# The author disclaims copyright to this source code. In place of
|
||||||
|
# a legal notice, here is a blessing:
|
||||||
|
#
|
||||||
|
# May you do good and not evil.
|
||||||
|
# May you find forgiveness for yourself and forgive others.
|
||||||
|
# May you share freely, never taking more than you give.
|
||||||
|
#
|
||||||
|
#*************************************************************************
|
||||||
|
# This file implements regression tests for SQLite library. The
|
||||||
|
# focus of this script is testing the FTS2 module.
|
||||||
|
#
|
||||||
|
# $Id: fts2a.test,v 1.1 2006/10/19 23:36:26 shess Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
set testdir [file dirname $argv0]
|
||||||
|
source $testdir/tester.tcl
|
||||||
|
|
||||||
|
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
|
||||||
|
ifcapable !fts2 {
|
||||||
|
finish_test
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Construct a full-text search table containing five keywords:
|
||||||
|
# one, two, three, four, and five, in various combinations. The
|
||||||
|
# rowid for each will be a bitmask for the elements it contains.
|
||||||
|
#
|
||||||
|
db eval {
|
||||||
|
CREATE VIRTUAL TABLE t1 USING fts2(content);
|
||||||
|
INSERT INTO t1(content) VALUES('one');
|
||||||
|
INSERT INTO t1(content) VALUES('two');
|
||||||
|
INSERT INTO t1(content) VALUES('one two');
|
||||||
|
INSERT INTO t1(content) VALUES('three');
|
||||||
|
INSERT INTO t1(content) VALUES('one three');
|
||||||
|
INSERT INTO t1(content) VALUES('two three');
|
||||||
|
INSERT INTO t1(content) VALUES('one two three');
|
||||||
|
INSERT INTO t1(content) VALUES('four');
|
||||||
|
INSERT INTO t1(content) VALUES('one four');
|
||||||
|
INSERT INTO t1(content) VALUES('two four');
|
||||||
|
INSERT INTO t1(content) VALUES('one two four');
|
||||||
|
INSERT INTO t1(content) VALUES('three four');
|
||||||
|
INSERT INTO t1(content) VALUES('one three four');
|
||||||
|
INSERT INTO t1(content) VALUES('two three four');
|
||||||
|
INSERT INTO t1(content) VALUES('one two three four');
|
||||||
|
INSERT INTO t1(content) VALUES('five');
|
||||||
|
INSERT INTO t1(content) VALUES('one five');
|
||||||
|
INSERT INTO t1(content) VALUES('two five');
|
||||||
|
INSERT INTO t1(content) VALUES('one two five');
|
||||||
|
INSERT INTO t1(content) VALUES('three five');
|
||||||
|
INSERT INTO t1(content) VALUES('one three five');
|
||||||
|
INSERT INTO t1(content) VALUES('two three five');
|
||||||
|
INSERT INTO t1(content) VALUES('one two three five');
|
||||||
|
INSERT INTO t1(content) VALUES('four five');
|
||||||
|
INSERT INTO t1(content) VALUES('one four five');
|
||||||
|
INSERT INTO t1(content) VALUES('two four five');
|
||||||
|
INSERT INTO t1(content) VALUES('one two four five');
|
||||||
|
INSERT INTO t1(content) VALUES('three four five');
|
||||||
|
INSERT INTO t1(content) VALUES('one three four five');
|
||||||
|
INSERT INTO t1(content) VALUES('two three four five');
|
||||||
|
INSERT INTO t1(content) VALUES('one two three four five');
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test fts2a-1.1 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
|
||||||
|
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
|
||||||
|
do_test fts2a-1.2 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two'}
|
||||||
|
} {3 7 11 15 19 23 27 31}
|
||||||
|
do_test fts2a-1.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two one'}
|
||||||
|
} {3 7 11 15 19 23 27 31}
|
||||||
|
do_test fts2a-1.4 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two three'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-1.5 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one three two'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-1.6 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two three one'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-1.7 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two one three'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-1.8 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three one two'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-1.9 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three two one'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-1.10 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two THREE'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-1.11 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH ' ONE Two three '}
|
||||||
|
} {7 15 23 31}
|
||||||
|
|
||||||
|
do_test fts2a-2.1 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one"'}
|
||||||
|
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
|
||||||
|
do_test fts2a-2.2 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two"'}
|
||||||
|
} {3 7 11 15 19 23 27 31}
|
||||||
|
do_test fts2a-2.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"two one"'}
|
||||||
|
} {}
|
||||||
|
do_test fts2a-2.4 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two three"'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2a-2.5 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three two"'}
|
||||||
|
} {}
|
||||||
|
do_test fts2a-2.6 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two three four"'}
|
||||||
|
} {15 31}
|
||||||
|
do_test fts2a-2.7 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three two four"'}
|
||||||
|
} {}
|
||||||
|
do_test fts2a-2.8 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three five"'}
|
||||||
|
} {21}
|
||||||
|
do_test fts2a-2.9 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three" five'}
|
||||||
|
} {21 29}
|
||||||
|
do_test fts2a-2.10 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five "one three"'}
|
||||||
|
} {21 29}
|
||||||
|
do_test fts2a-2.11 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five "one three" four'}
|
||||||
|
} {29}
|
||||||
|
do_test fts2a-2.12 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five four "one three"'}
|
||||||
|
} {29}
|
||||||
|
do_test fts2a-2.13 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one three" four five'}
|
||||||
|
} {29}
|
||||||
|
|
||||||
|
do_test fts2a-3.1 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
|
||||||
|
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
|
||||||
|
do_test fts2a-3.2 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one -two'}
|
||||||
|
} {1 5 9 13 17 21 25 29}
|
||||||
|
do_test fts2a-3.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '-two one'}
|
||||||
|
} {1 5 9 13 17 21 25 29}
|
||||||
|
|
||||||
|
do_test fts2a-4.1 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one OR two'}
|
||||||
|
} {1 2 3 5 6 7 9 10 11 13 14 15 17 18 19 21 22 23 25 26 27 29 30 31}
|
||||||
|
do_test fts2a-4.2 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH '"one two" OR three'}
|
||||||
|
} {3 4 5 6 7 11 12 13 14 15 19 20 21 22 23 27 28 29 30 31}
|
||||||
|
do_test fts2a-4.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three OR "one two"'}
|
||||||
|
} {3 4 5 6 7 11 12 13 14 15 19 20 21 22 23 27 28 29 30 31}
|
||||||
|
do_test fts2a-4.4 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two OR three'}
|
||||||
|
} {3 5 7 11 13 15 19 21 23 27 29 31}
|
||||||
|
do_test fts2a-4.5 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three OR two one'}
|
||||||
|
} {3 5 7 11 13 15 19 21 23 27 29 31}
|
||||||
|
do_test fts2a-4.6 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one two OR three OR four'}
|
||||||
|
} {3 5 7 9 11 13 15 19 21 23 25 27 29 31}
|
||||||
|
do_test fts2a-4.7 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two OR three OR four one'}
|
||||||
|
} {3 5 7 9 11 13 15 19 21 23 25 27 29 31}
|
||||||
|
|
||||||
|
# Test the ability to handle NULL content
|
||||||
|
#
|
||||||
|
do_test fts2a-5.1 {
|
||||||
|
execsql {INSERT INTO t1(content) VALUES(NULL)}
|
||||||
|
} {}
|
||||||
|
do_test fts2a-5.2 {
|
||||||
|
set rowid [db last_insert_rowid]
|
||||||
|
execsql {SELECT content FROM t1 WHERE rowid=$rowid}
|
||||||
|
} {{}}
|
||||||
|
do_test fts2a-5.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH NULL}
|
||||||
|
} {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
finish_test
|
147
test/fts2b.test
Normal file
147
test/fts2b.test
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# 2006 September 13
|
||||||
|
#
|
||||||
|
# The author disclaims copyright to this source code. In place of
|
||||||
|
# a legal notice, here is a blessing:
|
||||||
|
#
|
||||||
|
# May you do good and not evil.
|
||||||
|
# May you find forgiveness for yourself and forgive others.
|
||||||
|
# May you share freely, never taking more than you give.
|
||||||
|
#
|
||||||
|
#*************************************************************************
|
||||||
|
# This file implements regression tests for SQLite library. The
|
||||||
|
# focus of this script is testing the FTS2 module.
|
||||||
|
#
|
||||||
|
# $Id: fts2b.test,v 1.1 2006/10/19 23:36:26 shess Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
set testdir [file dirname $argv0]
|
||||||
|
source $testdir/tester.tcl
|
||||||
|
|
||||||
|
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
|
||||||
|
ifcapable !fts2 {
|
||||||
|
finish_test
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fill the full-text index "t1" with phrases in english, spanish,
|
||||||
|
# and german. For the i-th row, fill in the names for the bits
|
||||||
|
# that are set in the value of i. The least significant bit is
|
||||||
|
# 1. For example, the value 5 is 101 in binary which will be
|
||||||
|
# converted to "one three" in english.
|
||||||
|
#
|
||||||
|
proc fill_multilanguage_fulltext_t1 {} {
|
||||||
|
set english {one two three four five}
|
||||||
|
set spanish {un dos tres cuatro cinco}
|
||||||
|
set german {eine zwei drei vier funf}
|
||||||
|
|
||||||
|
for {set i 1} {$i<=31} {incr i} {
|
||||||
|
set cmd "INSERT INTO t1 VALUES"
|
||||||
|
set vset {}
|
||||||
|
foreach lang {english spanish german} {
|
||||||
|
set words {}
|
||||||
|
for {set j 0; set k 1} {$j<5} {incr j; incr k $k} {
|
||||||
|
if {$k&$i} {lappend words [lindex [set $lang] $j]}
|
||||||
|
}
|
||||||
|
lappend vset "'$words'"
|
||||||
|
}
|
||||||
|
set sql "INSERT INTO t1(english,spanish,german) VALUES([join $vset ,])"
|
||||||
|
# puts $sql
|
||||||
|
db eval $sql
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Construct a full-text search table containing five keywords:
|
||||||
|
# one, two, three, four, and five, in various combinations. The
|
||||||
|
# rowid for each will be a bitmask for the elements it contains.
|
||||||
|
#
|
||||||
|
db eval {
|
||||||
|
CREATE VIRTUAL TABLE t1 USING fts2(english,spanish,german);
|
||||||
|
}
|
||||||
|
fill_multilanguage_fulltext_t1
|
||||||
|
|
||||||
|
do_test fts2b-1.1 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE english MATCH 'one'}
|
||||||
|
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
|
||||||
|
do_test fts2b-1.2 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE spanish MATCH 'one'}
|
||||||
|
} {}
|
||||||
|
do_test fts2b-1.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE german MATCH 'one'}
|
||||||
|
} {}
|
||||||
|
do_test fts2b-1.4 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'one'}
|
||||||
|
} {1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31}
|
||||||
|
do_test fts2b-1.5 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'one dos drei'}
|
||||||
|
} {7 15 23 31}
|
||||||
|
do_test fts2b-1.6 {
|
||||||
|
execsql {SELECT english, spanish, german FROM t1 WHERE rowid=1}
|
||||||
|
} {one un eine}
|
||||||
|
do_test fts2b-1.7 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"one un"'}
|
||||||
|
} {}
|
||||||
|
|
||||||
|
do_test fts2b-2.1 {
|
||||||
|
execsql {
|
||||||
|
CREATE VIRTUAL TABLE t2 USING fts2(from,to);
|
||||||
|
INSERT INTO t2([from],[to]) VALUES ('one two three', 'four five six');
|
||||||
|
SELECT [from], [to] FROM t2
|
||||||
|
}
|
||||||
|
} {{one two three} {four five six}}
|
||||||
|
|
||||||
|
|
||||||
|
# Compute an SQL string that contains the words one, two, three,... to
|
||||||
|
# describe bits set in the value $i. Only the lower 5 bits are examined.
|
||||||
|
#
|
||||||
|
proc wordset {i} {
|
||||||
|
set x {}
|
||||||
|
for {set j 0; set k 1} {$j<5} {incr j; incr k $k} {
|
||||||
|
if {$k&$i} {lappend x [lindex {one two three four five} $j]}
|
||||||
|
}
|
||||||
|
return '$x'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a new FTS table with three columns:
|
||||||
|
#
|
||||||
|
# norm: words for the bits of rowid
|
||||||
|
# plusone: words for the bits of rowid+1
|
||||||
|
# invert: words for the bits of ~rowid
|
||||||
|
#
|
||||||
|
db eval {
|
||||||
|
CREATE VIRTUAL TABLE t4 USING fts2([norm],'plusone',"invert");
|
||||||
|
}
|
||||||
|
for {set i 1} {$i<=15} {incr i} {
|
||||||
|
set vset [list [wordset $i] [wordset [expr {$i+1}]] [wordset [expr {~$i}]]]
|
||||||
|
db eval "INSERT INTO t4(norm,plusone,invert) VALUES([join $vset ,]);"
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test fts2b-4.1 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one'}
|
||||||
|
} {1 3 5 7 9 11 13 15}
|
||||||
|
do_test fts2b-4.2 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE norm MATCH 'one'}
|
||||||
|
} {1 3 5 7 9 11 13 15}
|
||||||
|
do_test fts2b-4.3 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'one'}
|
||||||
|
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15}
|
||||||
|
do_test fts2b-4.4 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'plusone:one'}
|
||||||
|
} {2 4 6 8 10 12 14}
|
||||||
|
do_test fts2b-4.5 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE plusone MATCH 'one'}
|
||||||
|
} {2 4 6 8 10 12 14}
|
||||||
|
do_test fts2b-4.6 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one plusone:two'}
|
||||||
|
} {1 5 9 13}
|
||||||
|
do_test fts2b-4.7 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'norm:one two'}
|
||||||
|
} {1 3 5 7 9 11 13 15}
|
||||||
|
do_test fts2b-4.8 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'plusone:two norm:one'}
|
||||||
|
} {1 5 9 13}
|
||||||
|
do_test fts2b-4.9 {
|
||||||
|
execsql {SELECT rowid FROM t4 WHERE t4 MATCH 'two norm:one'}
|
||||||
|
} {1 3 5 7 9 11 13 15}
|
||||||
|
|
||||||
|
|
||||||
|
finish_test
|
1213
test/fts2c.test
Normal file
1213
test/fts2c.test
Normal file
File diff suppressed because it is too large
Load Diff
65
test/fts2d.test
Normal file
65
test/fts2d.test
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# 2006 October 1
|
||||||
|
#
|
||||||
|
# The author disclaims copyright to this source code. In place of
|
||||||
|
# a legal notice, here is a blessing:
|
||||||
|
#
|
||||||
|
# May you do good and not evil.
|
||||||
|
# May you find forgiveness for yourself and forgive others.
|
||||||
|
# May you share freely, never taking more than you give.
|
||||||
|
#
|
||||||
|
#*************************************************************************
|
||||||
|
# This file implements regression tests for SQLite library. The
|
||||||
|
# focus of this script is testing the FTS2 module, and in particular
|
||||||
|
# the Porter stemmer.
|
||||||
|
#
|
||||||
|
# $Id: fts2d.test,v 1.1 2006/10/19 23:36:26 shess Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
set testdir [file dirname $argv0]
|
||||||
|
source $testdir/tester.tcl
|
||||||
|
|
||||||
|
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
|
||||||
|
ifcapable !fts2 {
|
||||||
|
finish_test
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test fts2d-1.1 {
|
||||||
|
execsql {
|
||||||
|
CREATE VIRTUAL TABLE t1 USING fts2(content, tokenize porter);
|
||||||
|
INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
|
||||||
|
SELECT rowid FROM t1 WHERE content MATCH 'run jump';
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test fts2d-1.2 {
|
||||||
|
execsql {
|
||||||
|
SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump';
|
||||||
|
}
|
||||||
|
} {{<b>running</b> and <b>jumping</b>}}
|
||||||
|
do_test fts2d-1.3 {
|
||||||
|
execsql {
|
||||||
|
INSERT INTO t1(rowid, content)
|
||||||
|
VALUES(2, 'abcdefghijklmnopqrstuvwyxz');
|
||||||
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz'
|
||||||
|
}
|
||||||
|
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
|
||||||
|
do_test fts2d-1.4 {
|
||||||
|
execsql {
|
||||||
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz'
|
||||||
|
}
|
||||||
|
} {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
|
||||||
|
do_test fts2d-1.5 {
|
||||||
|
execsql {
|
||||||
|
INSERT INTO t1(rowid, content)
|
||||||
|
VALUES(3, 'The value is 123456789');
|
||||||
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789'
|
||||||
|
}
|
||||||
|
} {3 {The value is <b>123456789</b>}}
|
||||||
|
do_test fts2d-1.6 {
|
||||||
|
execsql {
|
||||||
|
SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789'
|
||||||
|
}
|
||||||
|
} {3 {The value is <b>123456789</b>}}
|
||||||
|
|
||||||
|
|
||||||
|
finish_test
|
85
test/fts2e.test
Normal file
85
test/fts2e.test
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# 2006 October 19
|
||||||
|
#
|
||||||
|
# The author disclaims copyright to this source code.
|
||||||
|
#
|
||||||
|
#*************************************************************************
|
||||||
|
# This file implements regression tests for SQLite library. The
|
||||||
|
# focus of this script is testing deletions in the FTS2 module.
|
||||||
|
#
|
||||||
|
# $Id: fts2e.test,v 1.1 2006/10/19 23:36:26 shess Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
set testdir [file dirname $argv0]
|
||||||
|
source $testdir/tester.tcl
|
||||||
|
|
||||||
|
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
|
||||||
|
ifcapable !fts2 {
|
||||||
|
finish_test
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Construct a full-text search table containing keywords which are the
|
||||||
|
# ordinal numbers of the bit positions set for a sequence of integers,
|
||||||
|
# which are used for the rowid. There are a total of 30 INSERT and
|
||||||
|
# DELETE statements, so that we'll test both the segmentMerge() merge
|
||||||
|
# (over the first 16) and the termSelect() merge (over the level-1
|
||||||
|
# segment and 14 level-0 segments).
|
||||||
|
db eval {
|
||||||
|
CREATE VIRTUAL TABLE t1 USING fts2(content);
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(1, 'one');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(2, 'two');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(3, 'one two');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(4, 'three');
|
||||||
|
DELETE FROM t1 WHERE rowid = 1;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(5, 'one three');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(6, 'two three');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(7, 'one two three');
|
||||||
|
DELETE FROM t1 WHERE rowid = 4;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(8, 'four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(9, 'one four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(10, 'two four');
|
||||||
|
DELETE FROM t1 WHERE rowid = 7;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(11, 'one two four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(12, 'three four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(13, 'one three four');
|
||||||
|
DELETE FROM t1 WHERE rowid = 10;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(14, 'two three four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(15, 'one two three four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(16, 'five');
|
||||||
|
DELETE FROM t1 WHERE rowid = 13;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(17, 'one five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(18, 'two five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(19, 'one two five');
|
||||||
|
DELETE FROM t1 WHERE rowid = 16;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(20, 'three five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(21, 'one three five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(22, 'two three five');
|
||||||
|
DELETE FROM t1 WHERE rowid = 19;
|
||||||
|
DELETE FROM t1 WHERE rowid = 22;
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test fts2f-1.1 {
|
||||||
|
execsql {SELECT COUNT(*) FROM t1}
|
||||||
|
} {14}
|
||||||
|
|
||||||
|
do_test fts2e-2.1 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
|
||||||
|
} {3 5 9 11 15 17 21}
|
||||||
|
|
||||||
|
do_test fts2e-2.2 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two'}
|
||||||
|
} {2 3 6 11 14 15 18}
|
||||||
|
|
||||||
|
do_test fts2e-2.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three'}
|
||||||
|
} {5 6 12 14 15 20 21}
|
||||||
|
|
||||||
|
do_test fts2e-2.4 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'four'}
|
||||||
|
} {8 9 11 12 14 15}
|
||||||
|
|
||||||
|
do_test fts2e-2.5 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five'}
|
||||||
|
} {17 18 20 21}
|
||||||
|
|
||||||
|
finish_test
|
90
test/fts2f.test
Normal file
90
test/fts2f.test
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# 2006 October 19
|
||||||
|
#
|
||||||
|
# The author disclaims copyright to this source code.
|
||||||
|
#
|
||||||
|
#*************************************************************************
|
||||||
|
# This file implements regression tests for SQLite library. The
|
||||||
|
# focus of this script is testing updates in the FTS2 module.
|
||||||
|
#
|
||||||
|
# $Id: fts2f.test,v 1.1 2006/10/19 23:36:26 shess Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
set testdir [file dirname $argv0]
|
||||||
|
source $testdir/tester.tcl
|
||||||
|
|
||||||
|
# If SQLITE_ENABLE_FTS2 is defined, omit this file.
|
||||||
|
ifcapable !fts2 {
|
||||||
|
finish_test
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Construct a full-text search table containing keywords which are the
|
||||||
|
# ordinal numbers of the bit positions set for a sequence of integers,
|
||||||
|
# which are used for the rowid. There are a total of 31 INSERT,
|
||||||
|
# UPDATE, and DELETE statements, so that we'll test both the
|
||||||
|
# segmentMerge() merge (over the first 16) and the termSelect() merge
|
||||||
|
# (over the level-1 segment and 15 level-0 segments).
|
||||||
|
db eval {
|
||||||
|
CREATE VIRTUAL TABLE t1 USING fts2(content);
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(1, 'one');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(2, 'two');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(3, 'one two');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(4, 'three');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(5, 'one three');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(6, 'two three');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(7, 'one two three');
|
||||||
|
DELETE FROM t1 WHERE rowid = 4;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(8, 'four');
|
||||||
|
UPDATE t1 SET content = 'update one three' WHERE rowid = 1;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(9, 'one four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(10, 'two four');
|
||||||
|
DELETE FROM t1 WHERE rowid = 7;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(11, 'one two four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(12, 'three four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(13, 'one three four');
|
||||||
|
DELETE FROM t1 WHERE rowid = 10;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(14, 'two three four');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(15, 'one two three four');
|
||||||
|
UPDATE t1 SET content = 'update two five' WHERE rowid = 8;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(16, 'five');
|
||||||
|
DELETE FROM t1 WHERE rowid = 13;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(17, 'one five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(18, 'two five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(19, 'one two five');
|
||||||
|
DELETE FROM t1 WHERE rowid = 16;
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(20, 'three five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(21, 'one three five');
|
||||||
|
INSERT INTO t1 (rowid, content) VALUES(22, 'two three five');
|
||||||
|
DELETE FROM t1 WHERE rowid = 19;
|
||||||
|
UPDATE t1 SET content = 'update' WHERE rowid = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test fts2f-1.1 {
|
||||||
|
execsql {SELECT COUNT(*) FROM t1}
|
||||||
|
} {16}
|
||||||
|
|
||||||
|
do_test fts2e-2.0 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'update'}
|
||||||
|
} {1 8 15}
|
||||||
|
|
||||||
|
do_test fts2e-2.1 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'one'}
|
||||||
|
} {1 3 5 9 11 17 21}
|
||||||
|
|
||||||
|
do_test fts2e-2.2 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'two'}
|
||||||
|
} {2 3 6 8 11 14 18 22}
|
||||||
|
|
||||||
|
do_test fts2e-2.3 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'three'}
|
||||||
|
} {1 5 6 12 14 20 21 22}
|
||||||
|
|
||||||
|
do_test fts2e-2.4 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'four'}
|
||||||
|
} {9 11 12 14}
|
||||||
|
|
||||||
|
do_test fts2e-2.5 {
|
||||||
|
execsql {SELECT rowid FROM t1 WHERE content MATCH 'five'}
|
||||||
|
} {8 17 18 20 21 22}
|
||||||
|
|
||||||
|
finish_test
|
Reference in New Issue
Block a user