/ Check-in [30d42dc6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug in fts4 to do with matchinfo and deferred tokens.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 30d42dc66f19ef5cc5b27d6273eadf56619a3ce8
User & Date: dan 2011-03-23 17:10:44
Context
2011-03-23
18:22
Increase the upper bound on SQLITE_MAX_ATTACHED from 30 to 62. check-in: 7aaf8772 user: drh tags: trunk
17:10
Fix a bug in fts4 to do with matchinfo and deferred tokens. check-in: 30d42dc6 user: dan tags: trunk
11:16
In the shell, make sure the ".log" command has at least one argument. check-in: 1ed5e361 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_snippet.c.

   876    876   */
   877    877   static int fts3ExprLocalHitsCb(
   878    878     Fts3Expr *pExpr,                /* Phrase expression node */
   879    879     int iPhrase,                    /* Phrase number */
   880    880     void *pCtx                      /* Pointer to MatchInfo structure */
   881    881   ){
   882    882     MatchInfo *p = (MatchInfo *)pCtx;
          883  +  int iStart = iPhrase * p->nCol * 3;
          884  +  int i;
          885  +
          886  +  for(i=0; i<p->nCol; i++) p->aMatchinfo[iStart+i*3] = 0;
   883    887   
   884    888     if( pExpr->aDoclist ){
   885    889       char *pCsr;
   886         -    int iStart = iPhrase * p->nCol * 3;
   887         -    int i;
   888         -
   889         -    for(i=0; i<p->nCol; i++) p->aMatchinfo[iStart+i*3] = 0;
   890    890   
   891    891       pCsr = sqlite3Fts3FindPositions(pExpr, p->pCursor->iPrevId, -1);
   892    892       if( pCsr ){
   893    893         fts3LoadColumnlistCounts(&pCsr, &p->aMatchinfo[iStart], 0);
   894    894       }
   895    895     }
   896    896   

Changes to test/fts3defer2.test.

    76     76   # Test cases fts3defer2-2.* focus specifically on the matchinfo function.
    77     77   # 
    78     78   do_execsql_test 2.1.1 "CREATE VIRTUAL TABLE t2 USING fts4"
    79     79   do_execsql_test 2.1.2 "INSERT INTO t2 VALUES('[string repeat {a } 10000]')"
    80     80   do_execsql_test 2.1.3 "INSERT INTO t2 VALUES('b [string repeat {z } 10000]')"
    81     81   do_execsql_test 2.1.4 [string repeat "INSERT INTO t2 VALUES('x');" 50]
    82     82   do_execsql_test 2.1.5 {
    83         -  INSERT INTO t2 VALUES('a b c d e f g');
           83  +  INSERT INTO t2 VALUES('a b c d e f g z');
    84     84     INSERT INTO t2 VALUES('a b c d e f g');
    85     85   }
    86     86   foreach {tn sql} {
    87     87     1 {}
    88     88     2 { INSERT INTO t2(t2) VALUES('optimize') }
    89     89     3 { UPDATE t2_segments SET block = zeroblob(length(block)) 
    90     90         WHERE length(block)>10000;
    91     91     }
    92     92   } {
    93     93     execsql $sql
    94     94   
    95         -  do_execsql_test 2.2.$tn {
           95  +  do_execsql_test 2.2.$tn.1 {
    96     96       SELECT mit(matchinfo(t2, 'pcxnal')) FROM t2 WHERE t2 MATCH 'a b';
    97     97     } [list                                          \
    98         -    [list 2 1  1 54 54  1 3 3  54 372 7]        \
           98  +    [list 2 1  1 54 54  1 3 3  54 372 8]        \
    99     99       [list 2 1  1 54 54  1 3 3  54 372 7]        \
   100    100     ]
          101  +
          102  +  set sqlite_fts3_enable_parentheses 1
          103  +  do_execsql_test 2.2.$tn.2 {
          104  +    SELECT mit(matchinfo(t2, 'x')) FROM t2 WHERE t2 MATCH 'g OR (g z)';
          105  +  } [list                                       \
          106  +    [list 1 2 2  1 2 2   1 54 54]               \
          107  +    [list 1 2 2  1 2 2   0 54 54]               \
          108  +  ]
          109  +  set sqlite_fts3_enable_parentheses 0
   101    110   }
   102    111   
   103    112   do_execsql_test 2.3.1 {
   104    113     CREATE VIRTUAL TABLE t3 USING fts4;
   105    114     INSERT INTO t3 VALUES('a b c d e f');
   106    115     INSERT INTO t3 VALUES('x b c d e f');
   107    116     INSERT INTO t3 VALUES('d e f a b c');