]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix an fts4 matchinf() problem triggered by deferred tokens that are part of phrases...
authordan <dan@noemail.net>
Mon, 25 May 2015 10:57:13 +0000 (10:57 +0000)
committerdan <dan@noemail.net>
Mon, 25 May 2015 10:57:13 +0000 (10:57 +0000)
FossilOrigin-Name: f1e942a1dda496a509741e9cc2a17e8b4dac63a3

ext/fts3/fts3.c
ext/fts3/fts3Int.h
ext/fts3/fts3_snippet.c
manifest
manifest.uuid
test/fts3defer2.test

index 8673ab7c3eedcec05296243eadae82dd2ab57936..ac492ff1afa68deb4edff9739ebd289278338593 100644 (file)
@@ -5074,7 +5074,7 @@ static int fts3EvalNearTrim(
 **   2. NEAR is treated as AND. If the expression is "x NEAR y", it is 
 **      advanced to point to the next row that matches "x AND y".
 ** 
-** See fts3EvalTestDeferredAndNear() for details on testing if a row is
+** See sqlite3Fts3EvalTestDeferred() for details on testing if a row is
 ** really a match, taking into account deferred tokens and NEAR operators.
 */
 static void fts3EvalNextRow(
@@ -5294,7 +5294,7 @@ static int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){
 }
 
 /*
-** This function is a helper function for fts3EvalTestDeferredAndNear().
+** This function is a helper function for sqlite3Fts3EvalTestDeferred().
 ** Assuming no error occurs or has occurred, It returns non-zero if the
 ** expression passed as the second argument matches the row that pCsr 
 ** currently points to, or zero if it does not.
@@ -5415,7 +5415,7 @@ static int fts3EvalTestExpr(
 ** Or, if no error occurs and it seems the current row does match the FTS
 ** query, return 0.
 */
-static int fts3EvalTestDeferredAndNear(Fts3Cursor *pCsr, int *pRc){
+int sqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc){
   int rc = *pRc;
   int bMiss = 0;
   if( rc==SQLITE_OK ){
@@ -5462,7 +5462,7 @@ static int fts3EvalNext(Fts3Cursor *pCsr){
       pCsr->isRequireSeek = 1;
       pCsr->isMatchinfoNeeded = 1;
       pCsr->iPrevId = pExpr->iDocid;
-    }while( pCsr->isEof==0 && fts3EvalTestDeferredAndNear(pCsr, &rc) );
+    }while( pCsr->isEof==0 && sqlite3Fts3EvalTestDeferred(pCsr, &rc) );
   }
 
   /* Check if the cursor is past the end of the docid range specified
@@ -5623,7 +5623,7 @@ static int fts3EvalGatherStats(
         pCsr->iPrevId = pRoot->iDocid;
       }while( pCsr->isEof==0 
            && pRoot->eType==FTSQUERY_NEAR 
-           && fts3EvalTestDeferredAndNear(pCsr, &rc) 
+           && sqlite3Fts3EvalTestDeferred(pCsr, &rc) 
       );
 
       if( rc==SQLITE_OK && pCsr->isEof==0 ){
@@ -5648,7 +5648,6 @@ static int fts3EvalGatherStats(
         fts3EvalNextRow(pCsr, pRoot, &rc);
         assert( pRoot->bEof==0 );
       }while( pRoot->iDocid!=iDocid && rc==SQLITE_OK );
-      fts3EvalTestDeferredAndNear(pCsr, &rc);
     }
   }
   return rc;
index 6db20b9fae2a3e0c6defb223918ac66c0dd1f87e..981c37deee511acf43a8450d15717766a6b96f79 100644 (file)
@@ -551,6 +551,7 @@ void sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,int*,u8*);
 int sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *);
 int sqlite3Fts3FirstFilter(sqlite3_int64, char *, int, char *);
 void sqlite3Fts3CreateStatTable(int*, Fts3Table*);
+int sqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc);
 
 /* fts3_tokenizer.c */
 const char *sqlite3Fts3NextToken(const char *, int *);
index a018a2bcdfea83448427d4d1c6dcc4002704e71d..d3b6a78a346f5b4f575ff01a8857691034481b13 100644 (file)
@@ -1288,6 +1288,7 @@ static int fts3MatchinfoValues(
             if( rc!=SQLITE_OK ) break;
           }
           rc = fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo);
+          sqlite3Fts3EvalTestDeferred(pCsr, &rc);
           if( rc!=SQLITE_OK ) break;
         }
         (void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo);
index 28621753ef9b5865cf2749834db54b942577339d..aed28911d8bf791ccf3ee106897f23a6f06b3cdb 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\san\sobsolete\scomment\s-\sno\schanges\sto\scode.
-D 2015-05-25T10:29:52.538
+C Fix\san\sfts4\smatchinf()\sproblem\striggered\sby\sdeferred\stokens\sthat\sare\spart\sof\sphrases\sthat\sare\spart\sof\sAND\sexpressions.
+D 2015-05-25T10:57:13.025
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 0a6ae26396ec696221021780dffbb894ff3cead7
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -78,16 +78,16 @@ 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 341e9d9a3c7615bac8e815a8937d576265b22f78
+F ext/fts3/fts3.c a95de5190cf52f4fa9d5952890399cab63e632b9
 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
-F ext/fts3/fts3Int.h 142837a7544dff49121b67091a71c4f7a4546b0f
+F ext/fts3/fts3Int.h 601743955ac43a0e82e6828a931c07bb3b0c95ff
 F ext/fts3/fts3_aux.c 9edc3655fcb287f0467d0a4b886a01c6185fe9f1
 F ext/fts3/fts3_expr.c 71c063da9c2a4167fb54aec089dd5ef33a58c9cb
 F ext/fts3/fts3_hash.c 29b986e43f4e9dd40110eafa377dc0d63c422c60
 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
 F ext/fts3/fts3_icu.c e319e108661147bcca8dd511cd562f33a1ba81b5
 F ext/fts3/fts3_porter.c 3565faf04b626cddf85f03825e86056a4562c009
-F ext/fts3/fts3_snippet.c 97a16ea233106b83b84a7a1e821318ea333688f7
+F ext/fts3/fts3_snippet.c 39a018b7796d6408883f059169b8cca1da1ec9de
 F ext/fts3/fts3_term.c 88c55a6fa1a51ab494e33dced0401a6c28791fd7
 F ext/fts3/fts3_test.c 8a3a78c4458b2d7c631fcf4b152a5cd656fa7038
 F ext/fts3/fts3_tokenize_vtab.c a27593ab19657166f6fa5ec073b678cc29a75860
@@ -599,7 +599,7 @@ F test/fts3corrupt2.test 6d96efae2f8a6af3eeaf283aba437e6d0e5447ba
 F test/fts3cov.test e0fb00d8b715ddae4a94c305992dfc3ef70353d7
 F test/fts3d.test 95c17d1b67b33a5eac0bf5a0d11116a0c0ac7a3a
 F test/fts3defer.test 0be4440b73a2e651fc1e472066686d6ada4b9963
-F test/fts3defer2.test e880e3b65bdf999f4746cdaefa65f14a98b9b724
+F test/fts3defer2.test c540f5f5c2840f70c68fd9b597df817ec7170468
 F test/fts3defer3.test dd53fc13223c6d8264a98244e9b19abd35ed71cd
 F test/fts3drop.test 1b906e293d6773812587b3dc458cb9e8f3f0c297
 F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851
@@ -1278,7 +1278,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 8c3929bd42ff9c041df341aced5b7dbc0f563506
-R 11e0e82c515ce5306d176915c715cba0
-U drh
-Z d2520be369a919344f6618089d325658
+P 4e4228c47f862c7f1fb078bf1b8c1d604f09d365
+R 342f9a9bdc1e4269db286539017c87a3
+U dan
+Z d0a64384331038a61aab1eaa287d5c77
index 4cff3ec3c84beb14c56068f66e48deb6ef27d625..625f3dff1087e27458320ba5bf85c9839211168c 100644 (file)
@@ -1 +1 @@
-4e4228c47f862c7f1fb078bf1b8c1d604f09d365
\ No newline at end of file
+f1e942a1dda496a509741e9cc2a17e8b4dac63a3
\ No newline at end of file
index 87af52461b5487ebe5f29407765865bac17aecbf..275e0f0eb36feb3b01b02855d45968ba0fb6a7de 100644 (file)
@@ -121,6 +121,12 @@ foreach {tn sql} {
     [list 1 2 2  1 2 2   0 54 54]               \
   ]
   set sqlite_fts3_enable_parentheses 0
+
+  do_execsql_test 2.2.$tn.4 {
+    SELECT mit(matchinfo(t2, 'x')) FROM t2 WHERE t2 MATCH 'e "g z"';
+  } [list                                       \
+    [list 1 2 2  1 2 2]                         \
+  ]
 }
 
 do_execsql_test 2.3.1 {