Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix crashes that can occur when queries are run on an FTS4 table containing zero rows. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | fts3-experimental |
Files: | files | file ages | folders |
SHA1: |
ed61fd20adef44d0f6b2345e0205b25f |
User & Date: | dan 2010-11-24 15:02:23.000 |
Context
2010-11-24
| ||
19:26 | Add code for the matchinfo 'longest common substring' feature. (check-in: 71011a4f9b user: dan tags: fts3-experimental) | |
15:02 | Fix crashes that can occur when queries are run on an FTS4 table containing zero rows. (check-in: ed61fd20ad user: dan tags: fts3-experimental) | |
11:51 | Remove some unused code from fts3. Add tests to fts3matchinfo.test. (check-in: ae40b34cf7 user: dan tags: fts3-experimental) | |
Changes
Changes to ext/fts3/fts3.c.
︙ | ︙ | |||
2294 2295 2296 2297 2298 2299 2300 | break; } } if( pCsr->eEvalmode==FTS3_EVAL_NEXT && pTok->pDeferred ){ rc = fts3DeferredTermSelect(pTok->pDeferred, isTermPos, &nList, &pList); }else{ | | | > | 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 | break; } } if( pCsr->eEvalmode==FTS3_EVAL_NEXT && pTok->pDeferred ){ rc = fts3DeferredTermSelect(pTok->pDeferred, isTermPos, &nList, &pList); }else{ if( pTok->pArray ){ rc = fts3TermSelect(p, pTok, iCol, isTermPos, &nList, &pList); } pTok->bFulltext = 1; } assert( rc!=SQLITE_OK || pCsr->eEvalmode || pTok->pArray==0 ); if( rc!=SQLITE_OK ) break; if( isFirst ){ pOut = pList; |
︙ | ︙ | |||
2523 2524 2525 2526 2527 2528 2529 | static int fts3ExprCost(Fts3Expr *pExpr){ int nCost; /* Return value */ if( pExpr->eType==FTSQUERY_PHRASE ){ Fts3Phrase *pPhrase = pExpr->pPhrase; int ii; nCost = 0; for(ii=0; ii<pPhrase->nToken; ii++){ | > > | > | 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 | static int fts3ExprCost(Fts3Expr *pExpr){ int nCost; /* Return value */ if( pExpr->eType==FTSQUERY_PHRASE ){ Fts3Phrase *pPhrase = pExpr->pPhrase; int ii; nCost = 0; for(ii=0; ii<pPhrase->nToken; ii++){ Fts3SegReaderArray *pArray = pPhrase->aToken[ii].pArray; if( pArray ){ nCost += pPhrase->aToken[ii].pArray->nCost; } } }else{ nCost = fts3ExprCost(pExpr->pLeft) + fts3ExprCost(pExpr->pRight); } return nCost; } |
︙ | ︙ | |||
2551 2552 2553 2554 2555 2556 2557 | ExprAndCost **ppExprCost /* OUT: Write to *ppExprCost */ ){ if( pExpr->eType==FTSQUERY_AND ){ fts3ExprAssignCosts(pExpr->pLeft, ppExprCost); fts3ExprAssignCosts(pExpr->pRight, ppExprCost); }else{ (*ppExprCost)->pExpr = pExpr; | | | 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 | ExprAndCost **ppExprCost /* OUT: Write to *ppExprCost */ ){ if( pExpr->eType==FTSQUERY_AND ){ fts3ExprAssignCosts(pExpr->pLeft, ppExprCost); fts3ExprAssignCosts(pExpr->pRight, ppExprCost); }else{ (*ppExprCost)->pExpr = pExpr; (*ppExprCost)->nCost = fts3ExprCost(pExpr); (*ppExprCost)++; } } /* ** Evaluate the full-text expression pExpr against FTS3 table pTab. Store ** the resulting doclist in *paOut and *pnOut. This routine mallocs for |
︙ | ︙ |
Changes to test/fts3matchinfo.test.
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # Check that with fts3, the "=" character is permitted in column definitions. # do_execsql_test 3.1 { CREATE VIRTUAL TABLE t3 USING fts3(mtchinfo=fts3); INSERT INTO t3(mtchinfo) VALUES('Beside the lake, beneath the trees'); SELECT mtchinfo FROM t3; } {{Beside the lake, beneath the trees}} #-------------------------------------------------------------------------- # Proc [do_matchinfo_test] is used to test the FTSX matchinfo() function. # # The first argument - $tn - is a test identifier. This may be either a # full identifier (i.e. "fts3matchinfo-1.1") or, if global var $testprefix | > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # Check that with fts3, the "=" character is permitted in column definitions. # do_execsql_test 3.1 { CREATE VIRTUAL TABLE t3 USING fts3(mtchinfo=fts3); INSERT INTO t3(mtchinfo) VALUES('Beside the lake, beneath the trees'); SELECT mtchinfo FROM t3; } {{Beside the lake, beneath the trees}} do_execsql_test 3.2 { CREATE VIRTUAL TABLE xx USING FTS4; SELECT * FROM xx WHERE xx MATCH 'abc'; SELECT * FROM xx WHERE xx MATCH 'a b c'; } #-------------------------------------------------------------------------- # Proc [do_matchinfo_test] is used to test the FTSX matchinfo() function. # # The first argument - $tn - is a test identifier. This may be either a # full identifier (i.e. "fts3matchinfo-1.1") or, if global var $testprefix |
︙ | ︙ |