1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Changes to run many fts5 tests with detail=none and detail=col tables as well as the default detail=full. Also fixes for the bugs uncovered by running said tests.

FossilOrigin-Name: 6322a1d984e7946735bace8a069ef24b31754b3b
This commit is contained in:
dan
2016-01-02 19:01:56 +00:00
parent 811501e237
commit fe0c3cfee1
15 changed files with 567 additions and 284 deletions

View File

@ -2327,6 +2327,68 @@ int sqlite3Fts5ExprPopulatePoslists(
);
}
static void fts5ExprClearPoslists(Fts5ExprNode *pNode){
if( pNode->eType==FTS5_TERM || pNode->eType==FTS5_STRING ){
pNode->pNear->apPhrase[0]->poslist.n = 0;
}else{
int i;
for(i=0; i<pNode->nChild; i++){
fts5ExprClearPoslists(pNode->apChild[i]);
}
}
}
static int fts5ExprCheckPoslists(Fts5ExprNode *pNode, i64 iRowid){
if( pNode ){
pNode->iRowid = iRowid;
pNode->bEof = 0;
switch( pNode->eType ){
case FTS5_TERM:
case FTS5_STRING:
return (pNode->pNear->apPhrase[0]->poslist.n>0);
case FTS5_AND: {
int i;
for(i=0; i<pNode->nChild; i++){
if( fts5ExprCheckPoslists(pNode->apChild[i], iRowid)==0 ){
fts5ExprClearPoslists(pNode);
return 0;
}
}
return 1;
}
case FTS5_OR: {
int i;
int bRet = 0;
for(i=0; i<pNode->nChild; i++){
if( fts5ExprCheckPoslists(pNode->apChild[i], iRowid) ){
bRet = 1;
}
}
if( bRet==0 ){
fts5ExprClearPoslists(pNode);
}
return bRet;
}
default: {
assert( pNode->eType==FTS5_NOT );
if( 0==fts5ExprCheckPoslists(pNode->apChild[0], iRowid)
|| 0!=fts5ExprCheckPoslists(pNode->apChild[1], iRowid)
){
fts5ExprClearPoslists(pNode);
return 0;
}
return 1;
}
}
}
}
void sqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){
fts5ExprCheckPoslists(pExpr->pRoot, iRowid);
}
/*
** This function is only called for detail=columns tables.
*/