]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix bugs in fts3 function matchinfo() when used with deferred tokens.
authordan <dan@noemail.net>
Thu, 25 Nov 2010 10:33:54 +0000 (10:33 +0000)
committerdan <dan@noemail.net>
Thu, 25 Nov 2010 10:33:54 +0000 (10:33 +0000)
FossilOrigin-Name: ddc2b7ec2618b010c981ecfa05b3e53a9fac686f

ext/fts3/fts3_snippet.c
manifest
manifest.uuid
test/fts3matchinfo.test

index ec468408bf0b895436be5c66b02641e575838ffe..3796d78f27bfe396ada3f94946007e072d4cf7dd 100644 (file)
@@ -1154,18 +1154,24 @@ static int fts3MatchinfoValues(
 
       case FTS3_MATCHINFO_HITS: {
         Fts3Expr *pExpr = pCsr->pExpr;
-        if( bGlobal ){
-          if( pCsr->pDeferred ){
-            rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0);
+        rc = fts3ExprLoadDoclists(pCsr, 0, 0);
+        if( rc==SQLITE_OK ){
+          if( bGlobal ){
+            if( pCsr->pDeferred ){
+              rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0);
+            }
+            (void)fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo);
           }
-          (void)fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo);
+          (void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo);
         }
-        (void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo);
         break;
       }
 
       case FTS3_MATCHINFO_LCS:
-        fts3MatchinfoLcs(pCsr, pInfo);
+        rc = fts3ExprLoadDoclists(pCsr, 0, 0);
+        if( rc==SQLITE_OK ){
+          fts3MatchinfoLcs(pCsr, pInfo);
+        }
         break;
 
       default:
index 711e3331d5579f2d5c6ff0b70d34b904f75ca3b1..3d94ca291d5a7a75e454ef5d9628819a7709ee52 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\scode\sfor\sthe\smatchinfo\s'longest\scommon\ssubstring'\sfeature.
-D 2010-11-24T19:26:19
+C Fix\sbugs\sin\sfts3\sfunction\smatchinfo()\swhen\sused\swith\sdeferred\stokens.
+D 2010-11-25T10:33:54
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in e7a59672eaeb04408d1fa8501618d7501a3c5e39
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -69,7 +69,7 @@ F ext/fts3/fts3_hash.c 3c8f6387a4a7f5305588b203fa7c887d753e1f1c
 F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec
 F ext/fts3/fts3_icu.c ac494aed69835008185299315403044664bda295
 F ext/fts3/fts3_porter.c 8df6f6efcc4e9e31f8bf73a4007c2e9abca1dfba
-F ext/fts3/fts3_snippet.c be2648ff61a18af2d4a33eadbb26c0a6f06a6e26
+F ext/fts3/fts3_snippet.c d765bda619c66e8f3b77f323c3c53cfc8dec84aa
 F ext/fts3/fts3_tokenizer.c 1301b0ee3ef414caae3257a702215925cc48cd9c
 F ext/fts3/fts3_tokenizer.h 13ffd9fcb397fec32a05ef5cd9e0fa659bf3dbd3
 F ext/fts3/fts3_tokenizer1.c 6e5cbaa588924ac578263a598e4fb9f5c9bb179d
@@ -446,7 +446,7 @@ F test/fts3expr.test 5e745b2b6348499d9ef8d59015de3182072c564c
 F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a
 F test/fts3fault.test 81fd40ceb12f33f9d16c5637d0f8d95d4556c456
 F test/fts3malloc.test 9c8cc3f885bb4dfc66d0460c52f68f45e4710d1b
-F test/fts3matchinfo.test 41991bd810c6896a07c19a236ba3b489b16ba970
+F test/fts3matchinfo.test 5f7c7a16f5911e05210f2eeda9df2f4567964f79
 F test/fts3near.test 2e318ee434d32babd27c167142e2b94ddbab4844
 F test/fts3query.test ef79d31fdb355d094baec1c1b24b60439a1fb8a2
 F test/fts3rnd.test 707533ce943f490443ce5e696236bb1675a37635
@@ -889,7 +889,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P ed61fd20adef44d0f6b2345e0205b25f3641a15e
-R c6aa2ef350d272455977bd9187b17fdc
+P 71011a4f9baf09ec6935ad591145252bf3c286ed
+R 08fa9c5772f6e2165a7fbe403b4e4263
 U dan
-Z a65c681ffac166b61fab0e3fae2a5af0
+Z afc34a2b2b43c5dc214681d1fbfcf7d4
index 716989eb8240f0d97d8f750136158c7b05abe883..f43ad87f81ee25e13191d0b98e1942b0493a7a97 100644 (file)
@@ -1 +1 @@
-71011a4f9baf09ec6935ad591145252bf3c286ed
\ No newline at end of file
+ddc2b7ec2618b010c981ecfa05b3e53a9fac686f
\ No newline at end of file
index 85b33206a07fd73caf94e4406768218df7945485..2100287e012e4fc5f365b5c330766ccd1ed07afd 100644 (file)
@@ -226,8 +226,12 @@ do_execsql_test 4.2.0 {
   INSERT INTO t5 VALUES('a a a a a');
   INSERT INTO t5 VALUES('a b a b a');
   INSERT INTO t5 VALUES('c b c b c');
+  INSERT INTO t5 VALUES('x x x x x');
+}
+do_matchinfo_test 4.2.1 t5 {t5 MATCH 'a a'}         { 
+  x {{5 8 2   5 8 2} {3 8 2   3 8 2}}
+  s {2 1} 
 }
-do_matchinfo_test 4.2.1 t5 {t5 MATCH 'a a'}         { s {2 1} }
 do_matchinfo_test 4.2.2 t5 {t5 MATCH 'a b'}         { s {2} }
 do_matchinfo_test 4.2.3 t5 {t5 MATCH 'a b a'}       { s {3} }
 do_matchinfo_test 4.2.4 t5 {t5 MATCH 'a a a'}       { s {3 1} }
@@ -235,27 +239,31 @@ do_matchinfo_test 4.2.5 t5 {t5 MATCH '"a b" "a b"'} { s {2} }
 do_matchinfo_test 4.2.6 t5 {t5 MATCH 'a OR b'}      { s {1 2 1} }
 
 do_execsql_test 4.3.0 "INSERT INTO t5 VALUES('x y [string repeat {b } 50000]')";
-do_execsql_test 4.3.0 "INSERT INTO t5 VALUES('x y [string repeat {x } 50000]')";
-
-#do_matchinfo_test 4.3.1 t5 {t5 MATCH 'a a'}         { s {2 1} }
-#do_matchinfo_test 4.3.2 t5 {t5 MATCH 'a b'}         { s {2} }
-#do_matchinfo_test 4.3.3 t5 {t5 MATCH 'a b a'}       { s {3} }
-#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 {
-#  UPDATE t5_segments 
-#  SET block = zeroblob(length(block)) 
-#  WHERE length(block)>10000;
-#}
-#
-#do_matchinfo_test 4.4.1 t5 {t5 MATCH 'a a'}         { s {2 1} }
-#do_matchinfo_test 4.4.2 t5 {t5 MATCH 'a b'}         { s {2} }
-#do_matchinfo_test 4.4.3 t5 {t5 MATCH 'a b a'}       { s {3} }
-#do_matchinfo_test 4.4.4 t5 {t5 MATCH 'a a a'}       { s {3 1} }
-#do_matchinfo_test 4.4.5 t5 {t5 MATCH '"a b" "a b"'} { s {2} }
-#do_matchinfo_test 4.4.6 t5 {t5 MATCH 'a OR b'}      { s {1 2 1 1} }
+
+do_matchinfo_test 4.3.1 t5 {t5 MATCH 'a a'} { 
+  x {{5 8 2   5 5 5} {3 8 2   3 5 5}}
+  s {2 1} 
+}
+
+do_matchinfo_test 4.3.2 t5 {t5 MATCH 'a b'}         { s {2} }
+do_matchinfo_test 4.3.3 t5 {t5 MATCH 'a b a'}       { s {3} }
+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_matchinfo_test 4.4.2 t5 {t5 MATCH 'a b'}         { s {2} }
+do_matchinfo_test 4.4.1 t5 {t5 MATCH 'a a'}         { s {2 1} }
+do_matchinfo_test 4.4.2 t5 {t5 MATCH 'a b'}         { s {2} }
+do_matchinfo_test 4.4.3 t5 {t5 MATCH 'a b a'}       { s {3} }
+do_matchinfo_test 4.4.4 t5 {t5 MATCH 'a a a'}       { s {3 1} }
+do_matchinfo_test 4.4.5 t5 {t5 MATCH '"a b" "a b"'} { s {2} }
 
 
 finish_test