Fix a problem in FTS3 phrase queries. Add tests to check that it really is fixed.

FossilOrigin-Name: 956de051f43dfc2f178a7820981da4bf69927190
This commit is contained in:
dan
2009-12-20 15:00:19 +00:00
parent c7d526e92b
commit e61fc3b6a8
4 changed files with 104 additions and 8 deletions
+2
View File
@@ -1310,6 +1310,7 @@ static int fts3DoclistMerge(
);
if( !aBuffer ){
*pnBuffer = 0;
return SQLITE_NOMEM;
}
@@ -1678,6 +1679,7 @@ static int fts3PhraseSelect(
sqlite3_free(pOut);
pOut = pList;
}
assert( nOut==0 || pOut!=0 );
}
if( rc==SQLITE_OK ){
+8 -7
View File
@@ -1,5 +1,5 @@
C Modified\sstatement\smachine\sin\ssqlite3_complete()\sto\sreturn\s0\son\sempty\sstring.\s\s\nAdded/updated\stests\sfor\ssame.\s\sTicket\s356c885b0b.
D 2009-12-17T22:17:39
C Fix\sa\sproblem\sin\sFTS3\sphrase\squeries.\sAdd\stests\sto\scheck\sthat\sit\sreally\sis\sfixed.
D 2009-12-20T15:00:19
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -56,7 +56,7 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c 682882c15f73acc1bcf11fa9c1832f7d7efae552
F ext/fts3/fts3.c 9c4ab6e74b20d9cc3806453f6fbdde6a84e97bb7
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 6fdd41b4f296e5bcc908444dc591397995d4ff5d
F ext/fts3/fts3_expr.c fcf6812dbfd9cb9a2cabaf50e741411794f83e7e
@@ -403,6 +403,7 @@ F test/fts3expr.test 05dab77387801e4900009917bb18f556037d82da
F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a
F test/fts3malloc.test d02ee86b21edd2b43044e0d6dfdcd26cb6efddcb
F test/fts3near.test dc196dd17b4606f440c580d45b3d23aa975fd077
F test/fts3query.test 5561e1feed538d91512e0357f46db6a5aca4bb4d
F test/fts3rnd.test 2a78df5478657fca6444ee03cf930437c47e9a5e
F test/func.test af106ed834001738246d276659406823e35cde7b
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
@@ -781,7 +782,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 85e3c73497d72d09becf728efe81041277ca1730
R 441a9b5eb3dd9b55570d6d08e1a1ee71
U shaneh
Z 240b5a79be1f4714cd0b02c34f1cf679
P 76eca7295cf7df4bef013af6c8c37251300cd383
R 7ac7e4b32e185dd57f665de6fbe0aef1
U dan
Z 3c6bba649fde926859de26956e1ee61f
+1 -1
View File
@@ -1 +1 @@
76eca7295cf7df4bef013af6c8c37251300cd383
956de051f43dfc2f178a7820981da4bf69927190
+93
View File
@@ -0,0 +1,93 @@
# 2009 December 20
#
# 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 contains tests of fts3 queries that have been useful during
# the development process as well as some that have been useful in tracking
# down bugs. They are not focused on any particular functionality.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If this build does not include FTS3, skip the tests in this file.
#
ifcapable !fts3 { finish_test ; return }
source $testdir/fts3_common.tcl
set DO_MALLOC_TEST 0
do_test fts3query-1.1 {
execsql {
CREATE VIRTUAL TABLE t1 USING fts3(x);
BEGIN;
INSERT INTO t1 VALUES('The source code for SQLite is in the public');
}
} {}
do_select_test fts3query-1.2 {
SELECT * FROM t1;
} {{The source code for SQLite is in the public}}
do_select_test fts3query-1.3 {
SELECT * FROM t1 WHERE t1 MATCH 'sqlite'
} {{The source code for SQLite is in the public}}
do_test fts3query-1.4 { execsql {COMMIT} } {}
do_select_test fts3query-1.5 {
SELECT * FROM t1;
} {{The source code for SQLite is in the public}}
do_select_test fts3query-1.6 {
SELECT * FROM t1 WHERE t1 MATCH 'sqlite'
} {{The source code for SQLite is in the public}}
set sqlite_fts3_enable_parentheses 1
do_test fts3query-2.1 {
execsql {
CREATE VIRTUAL TABLE zoink USING fts3;
INSERT INTO zoink VALUES('The apple falls far from the tree');
}
} {}
do_test fts3query-2.2 {
execsql {
SELECT docid FROM zoink WHERE zoink MATCH '(apple oranges) AND apple'
}
} {}
do_test fts3query-2.3 {
execsql {
SELECT docid FROM zoink WHERE zoink MATCH 'apple AND (oranges apple)'
}
} {}
set sqlite_fts3_enable_parentheses 0
do_test fts3query-3.1 {
execsql {
CREATE VIRTUAL TABLE foobar using FTS3(description, tokenize porter);
INSERT INTO foobar (description) values ('
Filed under: Emerging Technologies, EV/Plug-in, Hybrid, Chevrolet, GM,
ZENN 2011 Chevy Volt - Click above for high-res image gallery There are
16 days left in the month of December. Besides being time for most
Americans to kick their Christmas shopping sessions into high gear and
start planning their resolutions for 2010, it also means that there''s
precious little time for EEStor to "deliver functional technology" to
Zenn Motors as promised. Still, the promises held out by the secretive
company are too great for us to forget about entirely. We''d love for
EEStor''s claims to be independently verified and proven accurate, as
would just about anyone else looking to break free of petroleum in fav
');
}
} {}
do_test fts3query-3.2 {
execsql { SELECT docid FROM foobar WHERE description MATCH '"high sp d"' }
} {}
finish_test