mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
Strip whitespace
This commit is contained in:
parent
4c6e49ec58
commit
79d98dc1d3
1 changed files with 56 additions and 51 deletions
107
fts5.h
107
fts5.h
|
@ -10,7 +10,7 @@
|
||||||
**
|
**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
**
|
**
|
||||||
** Interfaces to extend FTS5. Using the interfaces defined in this file,
|
** Interfaces to extend FTS5. Using the interfaces defined in this file,
|
||||||
** FTS5 may be extended with:
|
** FTS5 may be extended with:
|
||||||
**
|
**
|
||||||
** * custom tokenizers, and
|
** * custom tokenizers, and
|
||||||
|
@ -38,6 +38,11 @@ typedef struct Fts5ExtensionApi Fts5ExtensionApi;
|
||||||
typedef struct Fts5Context Fts5Context;
|
typedef struct Fts5Context Fts5Context;
|
||||||
typedef struct Fts5PhraseIter Fts5PhraseIter;
|
typedef struct Fts5PhraseIter Fts5PhraseIter;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wrap fts5_xToken in a callback that takes an array of arrayrefs (?)
|
||||||
|
* ... instead of the user calling fts5_xToken themselves
|
||||||
|
* /
|
||||||
|
|
||||||
typedef void (*fts5_extension_function)(
|
typedef void (*fts5_extension_function)(
|
||||||
const Fts5ExtensionApi *pApi, /* API offered by current FTS version */
|
const Fts5ExtensionApi *pApi, /* API offered by current FTS version */
|
||||||
Fts5Context *pFts, /* First arg to pass to pApi functions */
|
Fts5Context *pFts, /* First arg to pass to pApi functions */
|
||||||
|
@ -55,19 +60,19 @@ struct Fts5PhraseIter {
|
||||||
** EXTENSION API FUNCTIONS
|
** EXTENSION API FUNCTIONS
|
||||||
**
|
**
|
||||||
** xUserData(pFts):
|
** xUserData(pFts):
|
||||||
** Return a copy of the context pointer the extension function was
|
** Return a copy of the context pointer the extension function was
|
||||||
** registered with.
|
** registered with.
|
||||||
**
|
**
|
||||||
** xColumnTotalSize(pFts, iCol, pnToken):
|
** xColumnTotalSize(pFts, iCol, pnToken):
|
||||||
** If parameter iCol is less than zero, set output variable *pnToken
|
** If parameter iCol is less than zero, set output variable *pnToken
|
||||||
** to the total number of tokens in the FTS5 table. Or, if iCol is
|
** to the total number of tokens in the FTS5 table. Or, if iCol is
|
||||||
** non-negative but less than the number of columns in the table, return
|
** non-negative but less than the number of columns in the table, return
|
||||||
** the total number of tokens in column iCol, considering all rows in
|
** the total number of tokens in column iCol, considering all rows in
|
||||||
** the FTS5 table.
|
** the FTS5 table.
|
||||||
**
|
**
|
||||||
** If parameter iCol is greater than or equal to the number of columns
|
** If parameter iCol is greater than or equal to the number of columns
|
||||||
** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
|
** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
|
||||||
** an OOM condition or IO error), an appropriate SQLite error code is
|
** an OOM condition or IO error), an appropriate SQLite error code is
|
||||||
** returned.
|
** returned.
|
||||||
**
|
**
|
||||||
** xColumnCount(pFts):
|
** xColumnCount(pFts):
|
||||||
|
@ -81,7 +86,7 @@ struct Fts5PhraseIter {
|
||||||
**
|
**
|
||||||
** If parameter iCol is greater than or equal to the number of columns
|
** If parameter iCol is greater than or equal to the number of columns
|
||||||
** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
|
** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
|
||||||
** an OOM condition or IO error), an appropriate SQLite error code is
|
** an OOM condition or IO error), an appropriate SQLite error code is
|
||||||
** returned.
|
** returned.
|
||||||
**
|
**
|
||||||
** This function may be quite inefficient if used with an FTS5 table
|
** This function may be quite inefficient if used with an FTS5 table
|
||||||
|
@ -108,8 +113,8 @@ struct Fts5PhraseIter {
|
||||||
** an error code (i.e. SQLITE_NOMEM) if an error occurs.
|
** an error code (i.e. SQLITE_NOMEM) if an error occurs.
|
||||||
**
|
**
|
||||||
** This API can be quite slow if used with an FTS5 table created with the
|
** This API can be quite slow if used with an FTS5 table created with the
|
||||||
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
||||||
** with either "detail=none" or "detail=column" and "content=" option
|
** with either "detail=none" or "detail=column" and "content=" option
|
||||||
** (i.e. if it is a contentless table), then this API always returns 0.
|
** (i.e. if it is a contentless table), then this API always returns 0.
|
||||||
**
|
**
|
||||||
** xInst:
|
** xInst:
|
||||||
|
@ -124,7 +129,7 @@ struct Fts5PhraseIter {
|
||||||
** code (i.e. SQLITE_NOMEM) if an error occurs.
|
** code (i.e. SQLITE_NOMEM) if an error occurs.
|
||||||
**
|
**
|
||||||
** This API can be quite slow if used with an FTS5 table created with the
|
** This API can be quite slow if used with an FTS5 table created with the
|
||||||
** "detail=none" or "detail=column" option.
|
** "detail=none" or "detail=column" option.
|
||||||
**
|
**
|
||||||
** xRowid:
|
** xRowid:
|
||||||
** Returns the rowid of the current row.
|
** Returns the rowid of the current row.
|
||||||
|
@ -140,11 +145,11 @@ struct Fts5PhraseIter {
|
||||||
**
|
**
|
||||||
** with $p set to a phrase equivalent to the phrase iPhrase of the
|
** with $p set to a phrase equivalent to the phrase iPhrase of the
|
||||||
** current query is executed. Any column filter that applies to
|
** current query is executed. Any column filter that applies to
|
||||||
** phrase iPhrase of the current query is included in $p. For each
|
** phrase iPhrase of the current query is included in $p. For each
|
||||||
** row visited, the callback function passed as the fourth argument
|
** row visited, the callback function passed as the fourth argument
|
||||||
** is invoked. The context and API objects passed to the callback
|
** is invoked. The context and API objects passed to the callback
|
||||||
** function may be used to access the properties of each matched row.
|
** function may be used to access the properties of each matched row.
|
||||||
** Invoking Api.xUserData() returns a copy of the pointer passed as
|
** Invoking Api.xUserData() returns a copy of the pointer passed as
|
||||||
** the third argument to pUserData.
|
** the third argument to pUserData.
|
||||||
**
|
**
|
||||||
** If the callback function returns any value other than SQLITE_OK, the
|
** If the callback function returns any value other than SQLITE_OK, the
|
||||||
|
@ -159,14 +164,14 @@ struct Fts5PhraseIter {
|
||||||
**
|
**
|
||||||
** xSetAuxdata(pFts5, pAux, xDelete)
|
** xSetAuxdata(pFts5, pAux, xDelete)
|
||||||
**
|
**
|
||||||
** Save the pointer passed as the second argument as the extension function's
|
** Save the pointer passed as the second argument as the extension function's
|
||||||
** "auxiliary data". The pointer may then be retrieved by the current or any
|
** "auxiliary data". The pointer may then be retrieved by the current or any
|
||||||
** future invocation of the same fts5 extension function made as part of
|
** future invocation of the same fts5 extension function made as part of
|
||||||
** the same MATCH query using the xGetAuxdata() API.
|
** the same MATCH query using the xGetAuxdata() API.
|
||||||
**
|
**
|
||||||
** Each extension function is allocated a single auxiliary data slot for
|
** Each extension function is allocated a single auxiliary data slot for
|
||||||
** each FTS query (MATCH expression). If the extension function is invoked
|
** each FTS query (MATCH expression). If the extension function is invoked
|
||||||
** more than once for a single FTS query, then all invocations share a
|
** more than once for a single FTS query, then all invocations share a
|
||||||
** single auxiliary data context.
|
** single auxiliary data context.
|
||||||
**
|
**
|
||||||
** If there is already an auxiliary data pointer when this function is
|
** If there is already an auxiliary data pointer when this function is
|
||||||
|
@ -185,7 +190,7 @@ struct Fts5PhraseIter {
|
||||||
**
|
**
|
||||||
** xGetAuxdata(pFts5, bClear)
|
** xGetAuxdata(pFts5, bClear)
|
||||||
**
|
**
|
||||||
** Returns the current auxiliary data pointer for the fts5 extension
|
** Returns the current auxiliary data pointer for the fts5 extension
|
||||||
** function. See the xSetAuxdata() method for details.
|
** function. See the xSetAuxdata() method for details.
|
||||||
**
|
**
|
||||||
** If the bClear argument is non-zero, then the auxiliary data is cleared
|
** If the bClear argument is non-zero, then the auxiliary data is cleared
|
||||||
|
@ -205,7 +210,7 @@ struct Fts5PhraseIter {
|
||||||
** method, to iterate through all instances of a single query phrase within
|
** method, to iterate through all instances of a single query phrase within
|
||||||
** the current row. This is the same information as is accessible via the
|
** the current row. This is the same information as is accessible via the
|
||||||
** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient
|
** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient
|
||||||
** to use, this API may be faster under some circumstances. To iterate
|
** to use, this API may be faster under some circumstances. To iterate
|
||||||
** through instances of phrase iPhrase, use the following code:
|
** through instances of phrase iPhrase, use the following code:
|
||||||
**
|
**
|
||||||
** Fts5PhraseIter iter;
|
** Fts5PhraseIter iter;
|
||||||
|
@ -223,8 +228,8 @@ struct Fts5PhraseIter {
|
||||||
** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
|
** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
|
||||||
**
|
**
|
||||||
** This API can be quite slow if used with an FTS5 table created with the
|
** This API can be quite slow if used with an FTS5 table created with the
|
||||||
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
** "detail=none" or "detail=column" option. If the FTS5 table is created
|
||||||
** with either "detail=none" or "detail=column" and "content=" option
|
** with either "detail=none" or "detail=column" and "content=" option
|
||||||
** (i.e. if it is a contentless table), then this API always iterates
|
** (i.e. if it is a contentless table), then this API always iterates
|
||||||
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
||||||
**
|
**
|
||||||
|
@ -248,16 +253,16 @@ struct Fts5PhraseIter {
|
||||||
** }
|
** }
|
||||||
**
|
**
|
||||||
** This API can be quite slow if used with an FTS5 table created with the
|
** This API can be quite slow if used with an FTS5 table created with the
|
||||||
** "detail=none" option. If the FTS5 table is created with either
|
** "detail=none" option. If the FTS5 table is created with either
|
||||||
** "detail=none" "content=" option (i.e. if it is a contentless table),
|
** "detail=none" "content=" option (i.e. if it is a contentless table),
|
||||||
** then this API always iterates through an empty set (all calls to
|
** then this API always iterates through an empty set (all calls to
|
||||||
** xPhraseFirstColumn() set iCol to -1).
|
** xPhraseFirstColumn() set iCol to -1).
|
||||||
**
|
**
|
||||||
** The information accessed using this API and its companion
|
** The information accessed using this API and its companion
|
||||||
** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
|
** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
|
||||||
** (or xInst/xInstCount). The chief advantage of this API is that it is
|
** (or xInst/xInstCount). The chief advantage of this API is that it is
|
||||||
** significantly more efficient than those alternatives when used with
|
** significantly more efficient than those alternatives when used with
|
||||||
** "detail=column" tables.
|
** "detail=column" tables.
|
||||||
**
|
**
|
||||||
** xPhraseNextColumn()
|
** xPhraseNextColumn()
|
||||||
** See xPhraseFirstColumn above.
|
** See xPhraseFirstColumn above.
|
||||||
|
@ -271,7 +276,7 @@ struct Fts5ExtensionApi {
|
||||||
int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);
|
int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);
|
||||||
int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);
|
int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);
|
||||||
|
|
||||||
int (*xTokenize)(Fts5Context*,
|
int (*xTokenize)(Fts5Context*,
|
||||||
const char *pText, int nText, /* Text to tokenize */
|
const char *pText, int nText, /* Text to tokenize */
|
||||||
void *pCtx, /* Context passed to xToken() */
|
void *pCtx, /* Context passed to xToken() */
|
||||||
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
||||||
|
@ -300,15 +305,15 @@ struct Fts5ExtensionApi {
|
||||||
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
|
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CUSTOM AUXILIARY FUNCTIONS
|
** CUSTOM AUXILIARY FUNCTIONS
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
** CUSTOM TOKENIZERS
|
** CUSTOM TOKENIZERS
|
||||||
**
|
**
|
||||||
** Applications may also register custom tokenizer types. A tokenizer
|
** Applications may also register custom tokenizer types. A tokenizer
|
||||||
** is registered by providing fts5 with a populated instance of the
|
** is registered by providing fts5 with a populated instance of the
|
||||||
** following structure. All structure methods must be defined, setting
|
** following structure. All structure methods must be defined, setting
|
||||||
** any member of the fts5_tokenizer struct to NULL leads to undefined
|
** any member of the fts5_tokenizer struct to NULL leads to undefined
|
||||||
** behaviour. The structure methods are expected to function as follows:
|
** behaviour. The structure methods are expected to function as follows:
|
||||||
|
@ -319,16 +324,16 @@ struct Fts5ExtensionApi {
|
||||||
**
|
**
|
||||||
** The first argument passed to this function is a copy of the (void*)
|
** The first argument passed to this function is a copy of the (void*)
|
||||||
** pointer provided by the application when the fts5_tokenizer object
|
** pointer provided by the application when the fts5_tokenizer object
|
||||||
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
||||||
** The second and third arguments are an array of nul-terminated strings
|
** The second and third arguments are an array of nul-terminated strings
|
||||||
** containing the tokenizer arguments, if any, specified following the
|
** containing the tokenizer arguments, if any, specified following the
|
||||||
** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
|
** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
|
||||||
** to create the FTS5 table.
|
** to create the FTS5 table.
|
||||||
**
|
**
|
||||||
** The final argument is an output variable. If successful, (*ppOut)
|
** The final argument is an output variable. If successful, (*ppOut)
|
||||||
** should be set to point to the new tokenizer handle and SQLITE_OK
|
** should be set to point to the new tokenizer handle and SQLITE_OK
|
||||||
** returned. If an error occurs, some value other than SQLITE_OK should
|
** returned. If an error occurs, some value other than SQLITE_OK should
|
||||||
** be returned. In this case, fts5 assumes that the final value of *ppOut
|
** be returned. In this case, fts5 assumes that the final value of *ppOut
|
||||||
** is undefined.
|
** is undefined.
|
||||||
**
|
**
|
||||||
** xDelete:
|
** xDelete:
|
||||||
|
@ -337,7 +342,7 @@ struct Fts5ExtensionApi {
|
||||||
** be invoked exactly once for each successful call to xCreate().
|
** be invoked exactly once for each successful call to xCreate().
|
||||||
**
|
**
|
||||||
** xTokenize:
|
** xTokenize:
|
||||||
** This function is expected to tokenize the nText byte string indicated
|
** This function is expected to tokenize the nText byte string indicated
|
||||||
** by argument pText. pText may or may not be nul-terminated. The first
|
** by argument pText. pText may or may not be nul-terminated. The first
|
||||||
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
||||||
** returned by an earlier call to xCreate().
|
** returned by an earlier call to xCreate().
|
||||||
|
@ -351,8 +356,8 @@ struct Fts5ExtensionApi {
|
||||||
** determine the set of tokens to add to (or delete from) the
|
** determine the set of tokens to add to (or delete from) the
|
||||||
** FTS index.
|
** FTS index.
|
||||||
**
|
**
|
||||||
** <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed
|
** <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed
|
||||||
** against the FTS index. The tokenizer is being called to tokenize
|
** against the FTS index. The tokenizer is being called to tokenize
|
||||||
** a bareword or quoted string specified as part of the query.
|
** a bareword or quoted string specified as part of the query.
|
||||||
**
|
**
|
||||||
** <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as
|
** <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as
|
||||||
|
@ -360,10 +365,10 @@ struct Fts5ExtensionApi {
|
||||||
** followed by a "*" character, indicating that the last token
|
** followed by a "*" character, indicating that the last token
|
||||||
** returned by the tokenizer will be treated as a token prefix.
|
** returned by the tokenizer will be treated as a token prefix.
|
||||||
**
|
**
|
||||||
** <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to
|
** <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to
|
||||||
** satisfy an fts5_api.xTokenize() request made by an auxiliary
|
** satisfy an fts5_api.xTokenize() request made by an auxiliary
|
||||||
** function. Or an fts5_api.xColumnSize() request made by the same
|
** function. Or an fts5_api.xColumnSize() request made by the same
|
||||||
** on a columnsize=0 database.
|
** on a columnsize=0 database.
|
||||||
** </ul>
|
** </ul>
|
||||||
**
|
**
|
||||||
** For each token in the input string, the supplied callback xToken() must
|
** For each token in the input string, the supplied callback xToken() must
|
||||||
|
@ -375,10 +380,10 @@ struct Fts5ExtensionApi {
|
||||||
** which the token is derived within the input.
|
** which the token is derived within the input.
|
||||||
**
|
**
|
||||||
** The second argument passed to the xToken() callback ("tflags") should
|
** The second argument passed to the xToken() callback ("tflags") should
|
||||||
** normally be set to 0. The exception is if the tokenizer supports
|
** normally be set to 0. The exception is if the tokenizer supports
|
||||||
** synonyms. In this case see the discussion below for details.
|
** synonyms. In this case see the discussion below for details.
|
||||||
**
|
**
|
||||||
** FTS5 assumes the xToken() callback is invoked for each token in the
|
** FTS5 assumes the xToken() callback is invoked for each token in the
|
||||||
** order that they occur within the input text.
|
** order that they occur within the input text.
|
||||||
**
|
**
|
||||||
** If an xToken() callback returns any value other than SQLITE_OK, then
|
** If an xToken() callback returns any value other than SQLITE_OK, then
|
||||||
|
@ -392,7 +397,7 @@ struct Fts5ExtensionApi {
|
||||||
** SYNONYM SUPPORT
|
** SYNONYM SUPPORT
|
||||||
**
|
**
|
||||||
** Custom tokenizers may also support synonyms. Consider a case in which a
|
** Custom tokenizers may also support synonyms. Consider a case in which a
|
||||||
** user wishes to query for a phrase such as "first place". Using the
|
** user wishes to query for a phrase such as "first place". Using the
|
||||||
** built-in tokenizers, the FTS5 query 'first + place' will match instances
|
** built-in tokenizers, the FTS5 query 'first + place' will match instances
|
||||||
** of "first place" within the document set, but not alternative forms
|
** of "first place" within the document set, but not alternative forms
|
||||||
** such as "1st place". In some applications, it would be better to match
|
** such as "1st place". In some applications, it would be better to match
|
||||||
|
@ -412,34 +417,34 @@ struct Fts5ExtensionApi {
|
||||||
**
|
**
|
||||||
** <li> By querying the index for all synonyms of each query term
|
** <li> By querying the index for all synonyms of each query term
|
||||||
** separately. In this case, when tokenizing query text, the
|
** separately. In this case, when tokenizing query text, the
|
||||||
** tokenizer may provide multiple synonyms for a single term
|
** tokenizer may provide multiple synonyms for a single term
|
||||||
** within the document. FTS5 then queries the index for each
|
** within the document. FTS5 then queries the index for each
|
||||||
** synonym individually. For example, faced with the query:
|
** synonym individually. For example, faced with the query:
|
||||||
**
|
**
|
||||||
** <codeblock>
|
** <codeblock>
|
||||||
** ... MATCH 'first place'</codeblock>
|
** ... MATCH 'first place'</codeblock>
|
||||||
**
|
**
|
||||||
** the tokenizer offers both "1st" and "first" as synonyms for the
|
** the tokenizer offers both "1st" and "first" as synonyms for the
|
||||||
** first token in the MATCH query and FTS5 effectively runs a query
|
** first token in the MATCH query and FTS5 effectively runs a query
|
||||||
** similar to:
|
** similar to:
|
||||||
**
|
**
|
||||||
** <codeblock>
|
** <codeblock>
|
||||||
** ... MATCH '(first OR 1st) place'</codeblock>
|
** ... MATCH '(first OR 1st) place'</codeblock>
|
||||||
**
|
**
|
||||||
** except that, for the purposes of auxiliary functions, the query
|
** except that, for the purposes of auxiliary functions, the query
|
||||||
** still appears to contain just two phrases - "(first OR 1st)"
|
** still appears to contain just two phrases - "(first OR 1st)"
|
||||||
** being treated as a single phrase.
|
** being treated as a single phrase.
|
||||||
**
|
**
|
||||||
** <li> By adding multiple synonyms for a single term to the FTS index.
|
** <li> By adding multiple synonyms for a single term to the FTS index.
|
||||||
** Using this method, when tokenizing document text, the tokenizer
|
** Using this method, when tokenizing document text, the tokenizer
|
||||||
** provides multiple synonyms for each token. So that when a
|
** provides multiple synonyms for each token. So that when a
|
||||||
** document such as "I won first place" is tokenized, entries are
|
** document such as "I won first place" is tokenized, entries are
|
||||||
** added to the FTS index for "i", "won", "first", "1st" and
|
** added to the FTS index for "i", "won", "first", "1st" and
|
||||||
** "place".
|
** "place".
|
||||||
**
|
**
|
||||||
** This way, even if the tokenizer does not provide synonyms
|
** This way, even if the tokenizer does not provide synonyms
|
||||||
** when tokenizing query text (it should not - to do so would be
|
** when tokenizing query text (it should not - to do so would be
|
||||||
** inefficient), it doesn't matter if the user queries for
|
** inefficient), it doesn't matter if the user queries for
|
||||||
** 'first + place' or '1st + place', as there are entries in the
|
** 'first + place' or '1st + place', as there are entries in the
|
||||||
** FTS index corresponding to both forms of the first token.
|
** FTS index corresponding to both forms of the first token.
|
||||||
** </ol>
|
** </ol>
|
||||||
|
@ -460,11 +465,11 @@ struct Fts5ExtensionApi {
|
||||||
**
|
**
|
||||||
** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time
|
** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time
|
||||||
** xToken() is called. Multiple synonyms may be specified for a single token
|
** xToken() is called. Multiple synonyms may be specified for a single token
|
||||||
** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence.
|
** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence.
|
||||||
** There is no limit to the number of synonyms that may be provided for a
|
** There is no limit to the number of synonyms that may be provided for a
|
||||||
** single token.
|
** single token.
|
||||||
**
|
**
|
||||||
** In many cases, method (1) above is the best approach. It does not add
|
** In many cases, method (1) above is the best approach. It does not add
|
||||||
** extra data to the FTS index or require FTS5 to query for multiple terms,
|
** extra data to the FTS index or require FTS5 to query for multiple terms,
|
||||||
** so it is efficient in terms of disk space and query speed. However, it
|
** so it is efficient in terms of disk space and query speed. However, it
|
||||||
** does not support prefix queries very well. If, as suggested above, the
|
** does not support prefix queries very well. If, as suggested above, the
|
||||||
|
@ -476,18 +481,18 @@ struct Fts5ExtensionApi {
|
||||||
** will not match documents that contain the token "1st" (as the tokenizer
|
** will not match documents that contain the token "1st" (as the tokenizer
|
||||||
** will probably not map "1s" to any prefix of "first").
|
** will probably not map "1s" to any prefix of "first").
|
||||||
**
|
**
|
||||||
** For full prefix support, method (3) may be preferred. In this case,
|
** For full prefix support, method (3) may be preferred. In this case,
|
||||||
** because the index contains entries for both "first" and "1st", prefix
|
** because the index contains entries for both "first" and "1st", prefix
|
||||||
** queries such as 'fi*' or '1s*' will match correctly. However, because
|
** queries such as 'fi*' or '1s*' will match correctly. However, because
|
||||||
** extra entries are added to the FTS index, this method uses more space
|
** extra entries are added to the FTS index, this method uses more space
|
||||||
** within the database.
|
** within the database.
|
||||||
**
|
**
|
||||||
** Method (2) offers a midpoint between (1) and (3). Using this method,
|
** Method (2) offers a midpoint between (1) and (3). Using this method,
|
||||||
** a query such as '1s*' will match documents that contain the literal
|
** a query such as '1s*' will match documents that contain the literal
|
||||||
** token "1st", but not "first" (assuming the tokenizer is not able to
|
** token "1st", but not "first" (assuming the tokenizer is not able to
|
||||||
** provide synonyms for prefixes). However, a non-prefix query like '1st'
|
** provide synonyms for prefixes). However, a non-prefix query like '1st'
|
||||||
** will match against "1st" and "first". This method does not require
|
** will match against "1st" and "first". This method does not require
|
||||||
** extra disk space, as no extra entries are added to the FTS index.
|
** extra disk space, as no extra entries are added to the FTS index.
|
||||||
** On the other hand, it may require more CPU cycles to run MATCH queries,
|
** On the other hand, it may require more CPU cycles to run MATCH queries,
|
||||||
** as separate queries of the FTS index are required for each synonym.
|
** as separate queries of the FTS index are required for each synonym.
|
||||||
**
|
**
|
||||||
|
@ -501,10 +506,10 @@ typedef struct fts5_tokenizer fts5_tokenizer;
|
||||||
struct fts5_tokenizer {
|
struct fts5_tokenizer {
|
||||||
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
||||||
void (*xDelete)(Fts5Tokenizer*);
|
void (*xDelete)(Fts5Tokenizer*);
|
||||||
int (*xTokenize)(Fts5Tokenizer*,
|
int (*xTokenize)(Fts5Tokenizer*,
|
||||||
void *pCtx,
|
void *pCtx,
|
||||||
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
||||||
const char *pText, int nText,
|
const char *pText, int nText,
|
||||||
int (*xToken)(
|
int (*xToken)(
|
||||||
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
||||||
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
||||||
|
|
Loading…
Add table
Reference in a new issue