Add the SQLITE_DISABLE_FTS4_DEFERRED compile time option.

FossilOrigin-Name: e799222f3b8246e65657a758437914ece7069ba9
This commit is contained in:
dan 2012-08-20 17:24:48 +00:00
parent a6b0a9cb80
commit 4dc3d73d69
12 changed files with 83 additions and 40 deletions

View File

@ -4436,6 +4436,7 @@ static int fts3EvalStart(Fts3Cursor *pCsr){
fts3EvalAllocateReaders(pCsr, pCsr->pExpr, &nToken, &nOr, &rc);
/* Determine which, if any, tokens in the expression should be deferred. */
#ifndef SQLITE_DISABLE_FTS4_DEFERRED
if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){
Fts3TokenAndCost *aTC;
Fts3Expr **apOr;
@ -4466,6 +4467,7 @@ static int fts3EvalStart(Fts3Cursor *pCsr){
sqlite3_free(aTC);
}
}
#endif
fts3EvalStartReaders(pCsr, pCsr->pExpr, 1, &rc);
return rc;
@ -4849,6 +4851,7 @@ static int fts3EvalTestExpr(
break;
default: {
#ifndef SQLITE_DISABLE_FTS4_DEFERRED
if( pCsr->pDeferred
&& (pExpr->iDocid==pCsr->iPrevId || pExpr->bDeferred)
){
@ -4860,7 +4863,9 @@ static int fts3EvalTestExpr(
*pRc = fts3EvalDeferredPhrase(pCsr, pPhrase);
bHit = (pPhrase->doclist.pList!=0);
pExpr->iDocid = pCsr->iPrevId;
}else{
}else
#endif
{
bHit = (pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId);
}
break;

View File

@ -427,10 +427,20 @@ int sqlite3Fts3ReadBlock(Fts3Table*, sqlite3_int64, char **, int*, int*);
int sqlite3Fts3SelectDoctotal(Fts3Table *, sqlite3_stmt **);
int sqlite3Fts3SelectDocsize(Fts3Table *, sqlite3_int64, sqlite3_stmt **);
#ifndef SQLITE_DISABLE_FTS4_DEFERRED
void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *);
int sqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int);
int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *);
void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *);
int sqlite3Fts3DeferredTokenList(Fts3DeferredToken *, char **, int *);
#else
# define sqlite3Fts3FreeDeferredTokens(x)
# define sqlite3Fts3DeferToken(x,y,z) SQLITE_OK
# define sqlite3Fts3CacheDeferredDoclists(x) SQLITE_OK
# define sqlite3Fts3FreeDeferredDoclists(x)
# define sqlite3Fts3DeferredTokenList(x,y,z) SQLITE_OK
#endif
void sqlite3Fts3SegmentsClose(Fts3Table *);
int sqlite3Fts3MaxLevel(Fts3Table *, int *);
@ -539,8 +549,6 @@ int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
int sqlite3Fts3DeferredTokenList(Fts3DeferredToken *, char **, int *);
/* fts3_unicode2.c (functions generated by parsing unicode text files) */
#ifdef SQLITE_ENABLE_FTS4_UNICODE61
int sqlite3FtsUnicodeFold(int, int);

View File

@ -5046,6 +5046,7 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){
return rc;
}
#ifndef SQLITE_DISABLE_FTS4_DEFERRED
/*
** Delete all cached deferred doclists. Deferred doclists are cached
** (allocated) by the sqlite3Fts3CacheDeferredDoclists() function.
@ -5183,6 +5184,7 @@ int sqlite3Fts3DeferToken(
return SQLITE_OK;
}
#endif
/*
** SQLite value pRowid contains the rowid of a row that may or may not be

View File

@ -1,5 +1,5 @@
C Change\sthe\scheckSpacing\sutility\sprogram\sto\signore\swhitespace\sat\send-of-line\nunless\sthe\s--wseol\soption\sis\sused.
D 2012-08-20T16:23:36.995
C Add\sthe\sSQLITE_DISABLE_FTS4_DEFERRED\scompile\stime\soption.
D 2012-08-20T17:24:48.768
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in abd5c10d21d1395f140d9e50ea999df8fa4d6376
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -55,9 +55,9 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c bb3107c0e420ea2e26e57050e84cdf0aeaafcd4f
F ext/fts3/fts3.c ab90126ee0163539d21d0618d22afa2eb645f7e2
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 81115435f79248ac09017bc665aae27b410d651f
F ext/fts3/fts3Int.h 1e58825246b56259267382d2f9902774c049460a
F ext/fts3/fts3_aux.c 5205182bd8f372782597888156404766edf5781e
F ext/fts3/fts3_expr.c dbc7ba4c3a6061adde0f38ed8e9b349568299551
F ext/fts3/fts3_hash.c 8dd2d06b66c72c628c2732555a32bc0943114914
@ -72,7 +72,7 @@ F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_unicode.c 49e36e6ba59f79e6bd6a8bfe434570fe48d20559
F ext/fts3/fts3_unicode2.c a863f05f758af36777dffc2facc898bc73fec896
F ext/fts3/fts3_write.c 794438f904cdf4516b258e530c0065efadb7b9b5
F ext/fts3/fts3_write.c f40042ba5602c58bdd94bd1b9e00205fb73d37cd
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/fts3/tool/fts3view.c 6cfc5b67a5f0e09c0d698f9fd012c784bfaa9197
@ -198,7 +198,7 @@ F src/test_async.c 0612a752896fad42d55c3999a5122af10dcf22ad
F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
F src/test_btree.c 5b89601dcb42a33ba8b820a6b763cc9cb48bac16
F src/test_config.c 9b37587750f247186ebeb02a02e8f17c611d1866
F src/test_config.c 09781397ccc24268cb895be0d4c21b4aad651486
F src/test_demovfs.c 20a4975127993f4959890016ae9ce5535a880094
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
F src/test_func.c 3a8dd37c08ab43b76d38eea2836e34a3897bf170
@ -464,7 +464,7 @@ F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8
F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
F test/fts3ao.test e7b80272efcced57d1d087a9da5c690dd7c21fd9
F test/fts3atoken.test fb398ab50aa232489e2a17f9b29d7ad3a3885f36
F test/fts3auto.test b39f3f51227aea145eae6638690355dbdf9abf18
F test/fts3auto.test 74315a7377403a57ba82a652a33704197fe1e4be
F test/fts3aux1.test 0b02743955d56fc0d4d66236a26177bd1b726de0
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
@ -474,8 +474,8 @@ F test/fts3corrupt.test 7b0f91780ca36118d73324ec803187208ad33b32
F test/fts3corrupt2.test 6d96efae2f8a6af3eeaf283aba437e6d0e5447ba
F test/fts3cov.test e0fb00d8b715ddae4a94c305992dfc3ef70353d7
F test/fts3d.test bf640d79722b720fa1c81834c48cdaa45d531b1a
F test/fts3defer.test 6c2707be1b05b9790ba8ff91d3391d5fb425269e
F test/fts3defer2.test 35867d33ba6db03f6c73bd6f5fc333ae14f68c81
F test/fts3defer.test 0be4440b73a2e651fc1e472066686d6ada4b9963
F test/fts3defer2.test 83f8744407b7663e36716a9066302d53d49ddf8b
F test/fts3drop.test 1b906e293d6773812587b3dc458cb9e8f3f0c297
F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851
F test/fts3expr.test 5e745b2b6348499d9ef8d59015de3182072c564c
@ -484,7 +484,7 @@ F test/fts3fault.test cb72dccb0a3b9f730f16c5240f3fcb9303eb1660
F test/fts3fault2.test 3198eef2804deea7cac8403e771d9cbcb752d887
F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
F test/fts3malloc.test b86ea33db9e8c58c0c2f8027a9fcadaf6a1568be
F test/fts3matchinfo.test 6507fe1c342e542300d65ea637d4110eccf894e6
F test/fts3matchinfo.test 15edde2c4d373d60449658176af7164d622a62f0
F test/fts3near.test 2e318ee434d32babd27c167142e2b94ddbab4844
F test/fts3prefix.test b36d4f00b128a51e7b386cc013a874246d9d7dc1
F test/fts3prefix2.test 477ca96e67f60745b7ac931cfa6e9b080c562da5
@ -493,7 +493,7 @@ F test/fts3rnd.test 1320d8826a845e38a96e769562bf83d7a92a15d0
F test/fts3shared.test 8bb266521d7c5495c0ae522bb4d376ad5387d4a2
F test/fts3snippet.test 8e956051221a34c7daeb504f023cb54d5fa5a8b2
F test/fts3sort.test 95be0b19d7e41c44b29014f13ea8bddd495fd659
F test/fts4aa.test 6e7f90420b837b2c685f3bcbe84c868492d40a68
F test/fts4aa.test 95f448fb02c4a976968b08d1b4ce134e720946ae
F test/fts4check.test 66fa274cab2b615f2fb338b257713aba8fad88a8
F test/fts4content.test 17b2360f7d1a9a7e5aa8022783f5c5731b6dfd4f
F test/fts4langid.test 24a6e41063b416bbdf371ff6b4476fa41c194aa7
@ -658,7 +658,7 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
F test/rdonly.test c267d050a1d9a6a321de502b737daf28821a518d
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/releasetest.mk 2eced2f9ae701fd0a29e714a241760503ccba25a
F test/releasetest.tcl 4014e2bfb93f276d82a604e7a5eda62c129916c9
F test/releasetest.tcl e48fd8e0e8abad89f30e08620790533ae4e02010
F test/rollback.test a1b4784b864331eae8b2a98c189efa2a8b11ff07
F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
F test/rowid.test e58e0acef38b527ed1b0b70d3ada588f804af287
@ -1011,7 +1011,7 @@ F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
P 7653973a525638b5e5e70ea8459f64e1a88befca
R a5b8e6d2b4446ec76e5e5bca66913847
U drh
Z 527e591104d273b6a0b9a4827096d42e
P be1faadebd9464f1c7d4cc26104f219ed35384b8
R 9d3902f63cfac6bb8ee3fe0483a0e736
U dan
Z a16ab6913bdfea9d4fad9944795f8c23

View File

@ -1 +1 @@
be1faadebd9464f1c7d4cc26104f219ed35384b8
e799222f3b8246e65657a758437914ece7069ba9

View File

@ -319,6 +319,12 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options", "fts3_unicode", "0", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_DISABLE_FTS4_DEFERRED
Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "0", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "fts4_deferred", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_OMIT_GET_TABLE
Tcl_SetVar2(interp, "sqlite_options", "gettable", "0", TCL_GLOBAL_ONLY);
#else

View File

@ -67,7 +67,7 @@ proc do_fts3query_test {tn args} {
foreach {k v} [lrange $args 0 [expr $nArg-3]] {
switch -- $k {
-deferred {
set deferred $v
ifcapable fts4_deferred { set deferred $v }
}
default {
error "bad option \"$k\": must be -deferred"
@ -509,9 +509,9 @@ foreach {tn create} {
do_fts3query_test 3.$tn.2.1 t1 {a OR c}
do_test 3.$tn.3 {
fts3_zero_long_segments t1 $limit
} {1}
ifcapable fts4_deferred {
do_test 3.$tn.3 { fts3_zero_long_segments t1 $limit } {1}
}
foreach {tn2 expr def} {
1 {a NEAR c} {}
@ -550,7 +550,11 @@ foreach {tn create} {
do_test 4.$tn.2 {
set limit [fts3_make_deferrable t1 five]
execsql { INSERT INTO t1(t1) VALUES('optimize') }
expr {[fts3_zero_long_segments t1 $limit]>0}
ifcapable fts4_deferred {
expr {[fts3_zero_long_segments t1 $limit]>0}
} else {
expr 1
}
} {1}
do_fts3query_test 4.$tn.3.1 -deferred five t1 {one AND five}

View File

@ -13,7 +13,7 @@ set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
ifcapable !fts3 {
ifcapable !fts3||!fts4_deferred {
finish_test
return
}

View File

@ -13,7 +13,10 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
ifcapable !fts3 { finish_test ; return }
ifcapable !fts3||!fts4_deferred {
finish_test
return
}
set testprefix fts3defer2

View File

@ -275,11 +275,14 @@ do_matchinfo_test 4.3.4 t5 {t5 MATCH 'a a a'} { s {3 1} }
do_matchinfo_test 4.3.5 t5 {t5 MATCH '"a b" "a b"'} { s {2} }
do_matchinfo_test 4.3.6 t5 {t5 MATCH 'a OR b'} { s {1 2 1 1} }
do_execsql_test 4.4.0 {
INSERT INTO t5(t5) VALUES('optimize');
UPDATE t5_segments
SET block = zeroblob(length(block))
WHERE length(block)>10000;
do_execsql_test 4.4.0.1 { INSERT INTO t5(t5) VALUES('optimize') }
ifcapable fts4_deferred {
do_execsql_test 4.4.0.2 {
UPDATE t5_segments
SET block = zeroblob(length(block))
WHERE length(block)>10000;
}
}
do_matchinfo_test 4.4.2 t5 {t5 MATCH 'a b'} { s {2} }

View File

@ -1655,14 +1655,16 @@ do_test fts4aa-1.8 {
SELECT docid FROM t1_docsize EXCEPT SELECT docid FROM t1
}
} {}
do_test fts4aa-1.9 {
# Note: Token 'in' is being deferred in the following query.
db eval {
SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1
WHERE t1 MATCH 'joseph died in egypt'
ORDER BY docid;
}
} {1050026 {4 1 1 1 1 1 1 1 2 1 1 1 1 1 1 23 23}}
ifcapable fts4_deferred {
do_test fts4aa-1.9 {
# Note: Token 'in' is being deferred in the following query.
db eval {
SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1
WHERE t1 MATCH 'joseph died in egypt'
ORDER BY docid;
}
} {1050026 {4 1 1 1 1 1 1 1 2 1 1 1 1 1 1 23 23}}
}
# Should get the same search results from FTS3
#

View File

@ -151,6 +151,15 @@ array set ::Configs {
-DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
-DSQLITE_MAX_ATTACHED=62
}
"Devkit" {
-DSQLITE_DEFAULT_FILE_FORMAT=4
-DSQLITE_MAX_ATTACHED=30
-DSQLITE_ENABLE_COLUMN_METADATA
-DSQLITE_ENABLE_FTS4
-DSQLITE_ENABLE_FTS4_PARENTHESIS
-DSQLITE_DISABLE_FTS4_DEFERRED
-DSQLITE_ENABLE_RTREE
}
}
array set ::Platforms {
@ -166,6 +175,7 @@ array set ::Platforms {
"Device-One" fulltest
}
Linux-i686 {
"Devkit" test
"Unlock-Notify" "QUICKTEST_INCLUDE=notify2.test test"
"Device-One" test
"Device-Two" test