DocList **pResult, /* Write the result doclist here */
Query *pQuery /* Put parsed query string here */
){
- int i, rc;
+ int i, iNext, rc;
DocList *pLeft = NULL;
- DocList *pRight, *pNew;
+ DocList *pRight, *pNew, *pOr;
int nNot = 0;
QueryTerm *aTerm;
/* Merge AND terms. */
aTerm = pQuery->pTerms;
- for(i = 0; i<pQuery->nTerms; i += aTerm[i].nPhrase + 1){
-
+ for(i = 0; i<pQuery->nTerms; i=iNext){
if( aTerm[i].isNot ){
/* Handle all NOT terms in a separate pass */
nNot++;
+ iNext = i + aTerm[i].nPhrase+1;
continue;
}
-
+ iNext = i + aTerm[i].nPhrase + 1;
rc = docListOfTerm(v, aTerm[i].iColumn, &aTerm[i], &pRight);
if( rc ){
queryClear(pQuery);
return rc;
}
+ while( iNext<pQuery->nTerms && aTerm[iNext].isOr ){
+ rc = docListOfTerm(v, aTerm[iNext].iColumn, &aTerm[iNext], &pOr);
+ iNext += aTerm[iNext].nPhrase + 1;
+ if( rc ){
+ queryClear(pQuery);
+ return rc;
+ }
+ pNew = docListNew(DL_DOCIDS);
+ docListOrMerge(pRight, pOr, pNew);
+ docListDelete(pRight);
+ docListDelete(pOr);
+ pRight = pNew;
+ }
if( pLeft==0 ){
pLeft = pRight;
}else{
pNew = docListNew(DL_DOCIDS);
- if( aTerm[i].isOr ){
- docListOrMerge(pLeft, pRight, pNew);
- }else{
- docListAndMerge(pLeft, pRight, pNew);
- }
+ docListAndMerge(pLeft, pRight, pNew);
docListDelete(pRight);
docListDelete(pLeft);
pLeft = pNew;
-C More\ssnippet\sgenerator\simprovements\sand\stest\scases.\s(CVS\s3449)
-D 2006-09-28T18:58:00
+C Fix\sa\sbug\sin\sthe\shandling\sof\sthe\sOR\soperator\sin\sFTS1.\s\sTest\scases\sadded\sto\nprevent\sa\srepeat.\s(CVS\s3450)
+D 2006-09-28T19:43:32
F Makefile.in cabd42d34340f49260bc2a7668c38eba8d4cfd99
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
F ext/fts1/ft_hash.h 1a35e654a235c2c662d3ca0dfc3138ad60b8b7d5
-F ext/fts1/fts1.c 197909c5a7de842db70f19424f146d2aa8d0cbe1
+F ext/fts1/fts1.c bad8872dd51a51bc433a6b2d4d199c939e033cb9
F ext/fts1/fts1.h 6060b8f62c1d925ea8356cb1a6598073eb9159a6
F ext/fts1/fts1_hash.c 3196cee866edbebb1c0521e21672e6d599965114
F ext/fts1/fts1_hash.h 957d378355ed29f672cd5add012ce8b088a5e089
F test/expr.test c78843f730ccbe973d0c2ad1c99978f936893131
F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
F test/format4.test bf3bed3b13c63abfb3cfec232597a319a31d0bcc
-F test/fts1a.test 8fa66282a2a297faebdab76279c1693eb7920a3b
+F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
F test/fts1b.test 5d8a01aefbecc8b7442b36c94c05eb7a845462d5
-F test/fts1c.test 0e24394ee94d784f5f9f1209f263b4ea6f6da15b
+F test/fts1c.test 8790cc74bfc3141772f5cc0252dcdef20832f755
F test/func.test 0ed54b5aeaad319f68016c033acfebef56f5874a
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P d3f4ae827582bd0aac54ae3211d272a1429b6523
-R b0a42d4df1bd94d2804b7ca6ec30b589
+P 0934d220b33c52024f42c89fa13326bd52333f39
+R 105e424a6b1cb9ae66050c731572cf3e
U drh
-Z 590788f47d28ad4e2ac7d0df17461f98
+Z ffcf097b13ab31485785605d678fc1c5
-0934d220b33c52024f42c89fa13326bd52333f39
\ No newline at end of file
+8cdf1d6ae018dfc93f8f0962b2530e31aa0bebff
\ No newline at end of file
# This file implements regression tests for SQLite library. The
# focus of this script is testing the FTS1 module.
#
-# $Id: fts1a.test,v 1.3 2006/09/28 11:41:41 drh Exp $
+# $Id: fts1a.test,v 1.4 2006/09/28 19:43:32 drh Exp $
#
set testdir [file dirname $argv0]
do_test fts1a-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 fts1a-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 fts1a-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 fts1a-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 fts1a-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
#
# This file implements regression tests for SQLite library. The
# focus of this script is testing the FTS1 module.
#
-# $Id: fts1c.test,v 1.9 2006/09/28 18:58:00 drh Exp $
+# $Id: fts1c.test,v 1.10 2006/09/28 19:43:32 drh Exp $
#
set testdir [file dirname $argv0]
PARSING <b>...</b>}}
+# Combinations of AND and OR operators:
+#
+do_test fts1c-5.1 {
+ execsql {
+ SELECT snippet(email) FROM email
+ WHERE email MATCH 'questar enron OR com'
+ }
+} {{matt.smith@<b>enron</b>.<b>com</b> <b>...</b> six reports:
+
+31 Keystone Receipts
+15 <b>Questar</b> Pipeline
+40 Rockies Production
+22 West_2 <b>...</b>}}
+do_test fts1c-5.2 {
+ execsql {
+ SELECT snippet(email) FROM email
+ WHERE email MATCH 'enron OR com questar'
+ }
+} {{matt.smith@<b>enron</b>.<b>com</b> <b>...</b> six reports:
+
+31 Keystone Receipts
+15 <b>Questar</b> Pipeline
+40 Rockies Production
+22 West_2 <b>...</b>}}
+
finish_test