From: drh Date: Tue, 23 Mar 2010 18:24:06 +0000 (+0000) Subject: More commenting and documentation enhancements in FTS3. X-Git-Tag: version-3.7.2~519 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7bca0a36602d9ba6a9675572489c7628d7ed254d;p=thirdparty%2Fsqlite.git More commenting and documentation enhancements in FTS3. FossilOrigin-Name: 892e286709c4a72aae364b85dd43bea525bb1b4d --- diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index ddbfa10f5d..16ffd773f2 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -313,20 +313,6 @@ SQLITE_EXTENSION_INIT1 #endif -/* -** The testcase() macro is only used by the amalgamation. If undefined, -** make it a no-op. -*/ -#ifndef testcase -# define testcase(X) -#endif - -/* -** Terminator values for position-lists and column-lists. -*/ -#define POS_COLUMN (1) /* Column-list terminator */ -#define POS_END (0) /* Position-list terminator */ - /* ** Write a 64-bit variable-length integer to memory starting at p[0]. ** The length of data written will be between 1 and FTS3_VARINT_MAX bytes. @@ -1312,11 +1298,11 @@ static int fts3PoslistPhraseMerge( int iCol1 = 0; int iCol2 = 0; assert( *p1!=0 && *p2!=0 ); - if( *p1==0x01 ){ + if( *p1==POS_COLUMN ){ p1++; p1 += sqlite3Fts3GetVarint32(p1, &iCol1); } - if( *p2==0x01 ){ + if( *p2==POS_COLUMN ){ p2++; p2 += sqlite3Fts3GetVarint32(p2, &iCol2); } @@ -1329,11 +1315,12 @@ static int fts3PoslistPhraseMerge( sqlite3_int64 iPos2 = 0; if( pp && iCol1 ){ - *p++ = 0x01; + *p++ = POS_COLUMN; p += sqlite3Fts3PutVarint(p, iCol1); } - assert( *p1!=0x00 && *p2!=0x00 && *p1!=0x01 && *p2!=0x01 ); + assert( *p1!=POS_END && *p1!=POS_COLUMN ); + assert( *p2!=POS_END && *p2!=POS_COLUMN ); fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2; fts3GetDeltaVarint(&p2, &iPos2); iPos2 -= 2; @@ -1585,6 +1572,7 @@ static int fts3DoclistMerge( default: assert( mergetype==MERGE_POS_NEAR || mergetype==MERGE_NEAR ); { char *aTmp = 0; char **ppPos = 0; + if( mergetype==MERGE_POS_NEAR ){ ppPos = &p; aTmp = sqlite3_malloc(2*(n1+n2+1)); @@ -1689,9 +1677,9 @@ static int fts3TermSelectCb( ** ** The returned doclist may be in one of two formats, depending on the ** value of parameter isReqPos. If isReqPos is zero, then the doclist is -** a sorted list of delta-compressed docids. If isReqPos is non-zero, -** then the returned list is in the same format as is stored in the -** database without the found length specifier at the start of on-disk +** a sorted list of delta-compressed docids (a bare doclist). If isReqPos +** is non-zero, then the returned list is in the same format as is stored +** in the database without the found length specifier at the start of on-disk ** doclists. */ static int fts3TermSelect( @@ -1951,7 +1939,9 @@ int sqlite3Fts3ExprNearTrim(Fts3Expr *pLeft, Fts3Expr *pRight, int nNear){ /* ** Evaluate the full-text expression pExpr against fts3 table pTab. Store -** the resulting doclist in *paOut and *pnOut. +** the resulting doclist in *paOut and *pnOut. This routine mallocs for +** the space needed to store the output. The caller is responsible for +** freeing the space when it has finished. */ static int evalFts3Expr( Fts3Table *p, /* Virtual table handle */ diff --git a/ext/fts3/fts3Int.h b/ext/fts3/fts3Int.h index c62cb0d0af..c5be598e14 100644 --- a/ext/fts3/fts3Int.h +++ b/ext/fts3/fts3Int.h @@ -53,6 +53,20 @@ */ #define FTS3_VARINT_MAX 10 +/* +** The testcase() macro is only used by the amalgamation. If undefined, +** make it a no-op. +*/ +#ifndef testcase +# define testcase(X) +#endif + +/* +** Terminator values for position-lists and column-lists. +*/ +#define POS_COLUMN (1) /* Column-list terminator */ +#define POS_END (0) /* Position-list terminator */ + /* ** This section provides definitions to allow the ** FTS3 extension to be compiled outside of the diff --git a/manifest b/manifest index 71d34c4713..8ef6b39f15 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Fix\sup\sobsolete\scomments\sin\sFTS3\sto\sconform\sto\sthe\slatest\snomenclature.\nAdd\snew\scomments\sto\sbetter\sexplain\sFTS3\soperation. -D 2010-03-23T15:46:41 +C More\scommenting\sand\sdocumentation\senhancements\sin\sFTS3. +D 2010-03-23T18:24:07 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -59,9 +59,9 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c e3b543c61c1f5228c9dcda94a91fe9715dd478a6 +F ext/fts3/fts3.c 20c55bed37307a2cd590387d33a9c8127b354ab4 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe -F ext/fts3/fts3Int.h df812ef35f1b47a44ec68a44ec0c2a769c973d85 +F ext/fts3/fts3Int.h 70528ba8c33991699f96ecc64112122833cdbdb5 F ext/fts3/fts3_expr.c f4ff02ebe854e97ac03ff00b38b728a9ab57fd4b F ext/fts3/fts3_hash.c 3c8f6387a4a7f5305588b203fa7c887d753e1f1c F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec @@ -796,14 +796,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 0fbdc431e832200efd87efd68456d5906397a219 -R 5a13810c3cec98f50780e17022f20048 +P 3e4a0082170155b5b779afd075a3ee650530ca68 +R 5227b1a15356eed32d5ce7971a352572 U drh -Z e5bf8ffae01fe0893ab06f3cfdcb0bf3 +Z 55be70887ecbe2a6b639a9af5e7abde1 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFLqOJkoxKgR168RlERAtFJAJ4maNX7/VkCMuFsUBiRvxwUrs9JIQCfagSh -3hvkVzOWUxcE2zfGubCfu9A= -=zHPO +iD8DBQFLqQdKoxKgR168RlERApBYAKCHb5ZhKZNk9Keu/8tRViMQHHsZ+ACfYBue +f4ixLxLJfwNjN74T1v76hhU= +=3nbs -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index db8d5dd688..954f20479a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3e4a0082170155b5b779afd075a3ee650530ca68 \ No newline at end of file +892e286709c4a72aae364b85dd43bea525bb1b4d \ No newline at end of file