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

Fix a bug parsing "<expr> AND (abc NEAR def)" in fts3_expr.c. (CVS 6091)

FossilOrigin-Name: d1a6a2edd799d65ff88510df951e909919e35b6b
This commit is contained in:
danielk1977
2009-01-01 04:19:51 +00:00
parent f3d20c04a2
commit 49b4b4d84a
4 changed files with 19 additions and 14 deletions

View File

@ -529,8 +529,9 @@ static int fts3ExprParse(
}
pNotBranch = pNot;
}else{
assert( p->eType!=FTSQUERY_PHRASE || !p->pPhrase->isNot );
isPhrase = (p->eType==FTSQUERY_PHRASE || p->pLeft);
int eType = p->eType;
assert( eType!=FTSQUERY_PHRASE || !p->pPhrase->isNot );
isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft);
if( !isPhrase && isRequirePhrase ){
sqlite3Fts3ExprFree(p);
rc = SQLITE_ERROR;
@ -554,8 +555,8 @@ static int fts3ExprParse(
}
if( pPrev && (
(pPrev->eType==FTSQUERY_NEAR && p->eType!=FTSQUERY_PHRASE)
|| (p->eType==FTSQUERY_NEAR && pPrev->eType!=FTSQUERY_PHRASE)
(pPrev->eType==FTSQUERY_NEAR && eType!=FTSQUERY_PHRASE)
|| (eType==FTSQUERY_NEAR && pPrev->eType!=FTSQUERY_PHRASE && !isPhrase)
)){
/* This is an attempt to do "phrase NEAR (bracketed expression)"
** or "(bracketed expression) NEAR phrase", both of which are