static void fts3ColumnlistCopy(char **pp, char **ppPoslist){
char *pEnd = *ppPoslist;
char c = 0;
+
+ /* A column-list is terminated by either a 0x01 or 0x00. */
while( 0xFE & (*pEnd | c) ) c = *pEnd++ & 0x80;
if( pp ){
int n = (int)(pEnd - *ppPoslist);
if( 0==(*p2&0xFE) ) i2 = 0x7FFFFFFF;
}
}else if( iCol1<iCol2 ){
+ if( iCol1 ){
+ int n = sqlite3Fts3PutVarint(&p[1], iCol1);
+ *p = 0x01;
+ p += n+1;
+ p1 += n+1;
+ }
fts3ColumnlistCopy(&p, &p1);
}else{
+ if( iCol2 ){
+ int n = sqlite3Fts3PutVarint(&p[1], iCol2);
+ *p = 0x01;
+ p += n+1;
+ p2 += n+1;
+ }
fts3ColumnlistCopy(&p, &p2);
}
}
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C In\sthe\sOSTRACE\sdebugging\smacros\sin\sos_unix.c,\sidentify\sthe\sVFS\scurrently\nin\suse.
-D 2009-12-04T14:25:19
+C Fix\sa\sproblem\sinvolving\sa\s3-way\sNEAR\squery.
+D 2009-12-04T19:07:25
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
-F ext/fts3/fts3.c da95f0191c2a016a78d12334ccfed76769043952
+F ext/fts3/fts3.c 54ad3e8f0374148768ad65724cff89a8a5a241a7
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h cc716c74afa7da8e0f8ef39404f33ea62a823eb3
F ext/fts3/fts3_expr.c c18794a62c257d3456d3314c5a18e348ae0d84bd
F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a
F test/fts3malloc.test d02ee86b21edd2b43044e0d6dfdcd26cb6efddcb
F test/fts3near.test dc196dd17b4606f440c580d45b3d23aa975fd077
-F test/fts3rnd.test 65f534898c5f7cce3f51b2c2dfc179e2287346b2
+F test/fts3rnd.test 071ff7ed7bf60f8f7502a3e09cbc680dbd795da1
F test/func.test af106ed834001738246d276659406823e35cde7b
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/fuzz.test a4174c3009a3e2c2e14b31b364ebf7ddb49de2c9
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 69c21ee46aeeb624fd8638b17ff7259a3e5f9a46
-R 400f092ce88a5a339c0b27b8a8415aa3
-U drh
-Z ed4cd334a82b89245ccfc3ad9b838d68
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFLGRvSoxKgR168RlERApe7AJ9uIN22ikW++Uqhi70+FZLKfs2R8gCfUGfY
-GTEEJa/7cpPCyUSqfXB/ROE=
-=u43h
------END PGP SIGNATURE-----
+P 082b8da005128f47f63e95b6b702bf4517221b2a
+R 8882a051c5ec0b862c5bc60eb34d651e
+U dan
+Z 1493d6f5f2ac30a6a5cc018ff1d6ae85
-082b8da005128f47f63e95b6b702bf4517221b2a
\ No newline at end of file
+507890a9139875b1b594225c432c714f67312c0e
\ No newline at end of file
}
proc simple_near {termlist nNear} {
+ set ret [list]
+
+ # List of nNear+1 elements that contains no terms.
+ #
+ set dummyfields "[string repeat "X " $nNear]X"
+
+ foreach {key value} [array get ::t1] {
+ foreach v $value {
+ set v [concat $dummyfields $v $dummyfields]
+
+ set l [lsearch -exact -all $v [lindex $termlist 0]]
+ foreach T [lrange $termlist 1 end] {
+ set l2 [list]
+ foreach i $l {
+ set iStart [expr $i - $nNear - 1]
+ set iEnd [expr $i + $nNear + 1]
+ foreach i2 [lsearch -exact -all [lrange $v $iStart $iEnd] $T] {
+ incr i2 $iStart
+ if {$i2 != $i} { lappend l2 $i2 }
+ }
+ }
+ set l $l2
+ }
+
+ if {[llength $l]} {
+ lappend ret $key
+ }
+ }
+ }
+
+ lsort -unique -integer $ret
}
foreach nodesize {50 500 1000 2000} {
# A NEAR query with terms as the arguments.
#
-if 0 {
for {set i 0} {$i < 10} {incr i} {
set terms [list [random_term] [random_term]]
set match [join $terms " NEAR "]
- do_test fts3rnd-1.$nodesize.$iTest.5.$i {
+ do_test fts3rnd-1.$nodesize.$iTest.5.$i.$match {
+ execsql { SELECT docid FROM t1 WHERE t1 MATCH $match }
+ } [simple_near $terms 10]
+ }
+
+if 0 {
+ # A 3-way NEAR query with terms as the arguments.
+ #
+ for {set i 0} {$i < 10} {incr i} {
+ set terms [list [random_term] [random_term] [random_term]]
+ set match [join $terms " NEAR "]
+ do_test fts3rnd-1.$nodesize.$iTest.5.$i.$match {
execsql { SELECT docid FROM t1 WHERE t1 MATCH $match }
} [simple_near $terms 10]
}