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

Test coverage improvements in the FTS3 porter stemmer.

FossilOrigin-Name: 6d112bfd53998b8f6693d3f2edbcd5ab4cdf5fb1
This commit is contained in:
drh
2009-11-30 19:48:16 +00:00
parent 63b94d64c3
commit ff3f307cd0
5 changed files with 34 additions and 15 deletions

View File

@ -53,6 +53,15 @@
*/
#define FTS3_VARINT_MAX 10
/*
** Macros indicating that conditional expressions are always true or
** false.
*/
#ifndef SQLITE_AMALGAMATION
# define ALWAYS(x) (x)
# define NEVER(X) (x)
#endif
typedef struct Fts3Table Fts3Table;
typedef struct Fts3Cursor Fts3Cursor;
typedef struct Fts3Expr Fts3Expr;

View File

@ -234,7 +234,7 @@ static int hasVowel(const char *z){
** the first two characters of z[].
*/
static int doubleConsonant(const char *z){
return isConsonant(z) && z[0]==z[1] && isConsonant(z+1);
return isConsonant(z) && z[0]==z[1];
}
/*
@ -247,10 +247,10 @@ static int doubleConsonant(const char *z){
*/
static int star_oh(const char *z){
return
z[0]!=0 && isConsonant(z) &&
isConsonant(z) &&
z[0]!='w' && z[0]!='x' && z[0]!='y' &&
z[1]!=0 && isVowel(z+1) &&
z[2]!=0 && isConsonant(z+2);
isVowel(z+1) &&
isConsonant(z+2);
}
/*

View File

@ -545,7 +545,7 @@ static int wordBoundary(
if( iBreak>=nDoc-10 ){
return nDoc;
}
for(i=0; i<nMatch && aMatch[i].iCol<iCol; i++){}
for(i=0; ALWAYS(i<nMatch) && aMatch[i].iCol<iCol; i++){}
while( i<nMatch && aMatch[i].iStart+aMatch[i].nByte<iBreak ){ i++; }
if( i<nMatch ){
if( aMatch[i].iStart<iBreak+10 ){