|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _FTS5INT_H |
|
|
#define _FTS5INT_H |
|
|
|
|
|
#include "fts5.h" |
|
|
#include "sqlite3ext.h" |
|
|
SQLITE_EXTENSION_INIT1 |
|
|
|
|
|
#include <string.h> |
|
|
#include <assert.h> |
|
|
|
|
|
#ifndef SQLITE_AMALGAMATION |
|
|
|
|
|
typedef unsigned char u8; |
|
|
typedef unsigned int u32; |
|
|
typedef unsigned short u16; |
|
|
typedef short i16; |
|
|
typedef sqlite3_int64 i64; |
|
|
typedef sqlite3_uint64 u64; |
|
|
|
|
|
#ifndef ArraySize |
|
|
# define ArraySize(x) ((int)(sizeof(x) / sizeof(x[0]))) |
|
|
#endif |
|
|
|
|
|
#define testcase(x) |
|
|
|
|
|
#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST) |
|
|
# define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1 |
|
|
#endif |
|
|
#if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS) |
|
|
# define ALWAYS(X) (1) |
|
|
# define NEVER(X) (0) |
|
|
#elif !defined(NDEBUG) |
|
|
# define ALWAYS(X) ((X)?1:(assert(0),0)) |
|
|
# define NEVER(X) ((X)?(assert(0),1):0) |
|
|
#else |
|
|
# define ALWAYS(X) (X) |
|
|
# define NEVER(X) (X) |
|
|
#endif |
|
|
|
|
|
#define MIN(x,y) (((x) < (y)) ? (x) : (y)) |
|
|
#define MAX(x,y) (((x) > (y)) ? (x) : (y)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32)) |
|
|
# define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) |
|
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_STDINT_H) |
|
|
typedef uintptr_t uptr; |
|
|
#elif SQLITE_PTRSIZE==4 |
|
|
typedef u32 uptr; |
|
|
#else |
|
|
typedef u64 uptr; |
|
|
#endif |
|
|
|
|
|
#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC |
|
|
# define EIGHT_BYTE_ALIGNMENT(X) ((((uptr)(X) - (uptr)0)&3)==0) |
|
|
#else |
|
|
# define EIGHT_BYTE_ALIGNMENT(X) ((((uptr)(X) - (uptr)0)&7)==0) |
|
|
#endif |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FTS5_MAX_TOKEN_SIZE 32768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FTS5_MAX_PREFIX_INDEXES 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FTS5_MAX_SEGMENT 2000 |
|
|
|
|
|
#define FTS5_DEFAULT_NEARDIST 10 |
|
|
#define FTS5_DEFAULT_RANK "bm25" |
|
|
|
|
|
|
|
|
#define FTS5_RANK_NAME "rank" |
|
|
#define FTS5_ROWID_NAME "rowid" |
|
|
|
|
|
#ifdef SQLITE_DEBUG |
|
|
# define FTS5_CORRUPT sqlite3Fts5Corrupt() |
|
|
int sqlite3Fts5Corrupt(void); |
|
|
#else |
|
|
# define FTS5_CORRUPT SQLITE_CORRUPT_VTAB |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SQLITE_DEBUG |
|
|
extern int sqlite3_fts5_may_be_corrupt; |
|
|
# define assert_nc(x) assert(sqlite3_fts5_may_be_corrupt || (x)) |
|
|
#else |
|
|
# define assert_nc(x) assert(x) |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define fts5Memcmp(s1, s2, n) ((n)<=0 ? 0 : memcmp((s1), (s2), (n))) |
|
|
|
|
|
|
|
|
|
|
|
#ifndef UNUSED_PARAM |
|
|
# define UNUSED_PARAM(X) (void)(X) |
|
|
#endif |
|
|
|
|
|
#ifndef UNUSED_PARAM2 |
|
|
# define UNUSED_PARAM2(X, Y) (void)(X), (void)(Y) |
|
|
#endif |
|
|
|
|
|
typedef struct Fts5Global Fts5Global; |
|
|
typedef struct Fts5Colset Fts5Colset; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Fts5Colset { |
|
|
int nCol; |
|
|
int aiCol[1]; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Fts5Config Fts5Config; |
|
|
typedef struct Fts5TokenizerConfig Fts5TokenizerConfig; |
|
|
|
|
|
struct Fts5TokenizerConfig { |
|
|
Fts5Tokenizer *pTok; |
|
|
fts5_tokenizer_v2 *pApi2; |
|
|
fts5_tokenizer *pApi1; |
|
|
const char **azArg; |
|
|
int nArg; |
|
|
int ePattern; |
|
|
const char *pLocale; |
|
|
int nLocale; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Fts5Config { |
|
|
sqlite3 *db; |
|
|
Fts5Global *pGlobal; |
|
|
char *zDb; |
|
|
char *zName; |
|
|
int nCol; |
|
|
char **azCol; |
|
|
u8 *abUnindexed; |
|
|
int nPrefix; |
|
|
int *aPrefix; |
|
|
int eContent; |
|
|
int bContentlessDelete; |
|
|
int bContentlessUnindexed; |
|
|
char *zContent; |
|
|
char *zContentRowid; |
|
|
int bColumnsize; |
|
|
int bTokendata; |
|
|
int bLocale; |
|
|
int eDetail; |
|
|
char *zContentExprlist; |
|
|
Fts5TokenizerConfig t; |
|
|
int bLock; |
|
|
|
|
|
|
|
|
|
|
|
int iVersion; |
|
|
int iCookie; |
|
|
int pgsz; |
|
|
int nAutomerge; |
|
|
int nCrisisMerge; |
|
|
int nUsermerge; |
|
|
int nHashSize; |
|
|
char *zRank; |
|
|
char *zRankArgs; |
|
|
int bSecureDelete; |
|
|
int nDeleteMerge; |
|
|
|
|
|
|
|
|
char **pzErrmsg; |
|
|
|
|
|
#ifdef SQLITE_DEBUG |
|
|
int bPrefixIndex; |
|
|
#endif |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FTS5_CURRENT_VERSION 4 |
|
|
#define FTS5_CURRENT_VERSION_SECUREDELETE 5 |
|
|
|
|
|
#define FTS5_CONTENT_NORMAL 0 |
|
|
#define FTS5_CONTENT_NONE 1 |
|
|
#define FTS5_CONTENT_EXTERNAL 2 |
|
|
#define FTS5_CONTENT_UNINDEXED 3 |
|
|
|
|
|
#define FTS5_DETAIL_FULL 0 |
|
|
#define FTS5_DETAIL_NONE 1 |
|
|
#define FTS5_DETAIL_COLUMNS 2 |
|
|
|
|
|
#define FTS5_PATTERN_NONE 0 |
|
|
#define FTS5_PATTERN_LIKE 65 |
|
|
#define FTS5_PATTERN_GLOB 66 |
|
|
|
|
|
int sqlite3Fts5ConfigParse( |
|
|
Fts5Global*, sqlite3*, int, const char **, Fts5Config**, char** |
|
|
); |
|
|
void sqlite3Fts5ConfigFree(Fts5Config*); |
|
|
|
|
|
int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig); |
|
|
|
|
|
int sqlite3Fts5Tokenize( |
|
|
Fts5Config *pConfig, |
|
|
int flags, |
|
|
const char *pText, int nText, |
|
|
void *pCtx, |
|
|
int (*xToken)(void*, int, const char*, int, int, int) |
|
|
); |
|
|
|
|
|
void sqlite3Fts5Dequote(char *z); |
|
|
|
|
|
|
|
|
int sqlite3Fts5ConfigLoad(Fts5Config*, int); |
|
|
|
|
|
|
|
|
int sqlite3Fts5ConfigSetValue(Fts5Config*, const char*, sqlite3_value*, int*); |
|
|
|
|
|
int sqlite3Fts5ConfigParseRank(const char*, char**, char**); |
|
|
|
|
|
void sqlite3Fts5ConfigErrmsg(Fts5Config *pConfig, const char *zFmt, ...); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Fts5Buffer Fts5Buffer; |
|
|
struct Fts5Buffer { |
|
|
u8 *p; |
|
|
int n; |
|
|
int nSpace; |
|
|
}; |
|
|
|
|
|
int sqlite3Fts5BufferSize(int*, Fts5Buffer*, u32); |
|
|
void sqlite3Fts5BufferAppendVarint(int*, Fts5Buffer*, i64); |
|
|
void sqlite3Fts5BufferAppendBlob(int*, Fts5Buffer*, u32, const u8*); |
|
|
void sqlite3Fts5BufferAppendString(int *, Fts5Buffer*, const char*); |
|
|
void sqlite3Fts5BufferFree(Fts5Buffer*); |
|
|
void sqlite3Fts5BufferZero(Fts5Buffer*); |
|
|
void sqlite3Fts5BufferSet(int*, Fts5Buffer*, int, const u8*); |
|
|
void sqlite3Fts5BufferAppendPrintf(int *, Fts5Buffer*, char *zFmt, ...); |
|
|
|
|
|
char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...); |
|
|
|
|
|
#define fts5BufferZero(x) sqlite3Fts5BufferZero(x) |
|
|
#define fts5BufferAppendVarint(a,b,c) sqlite3Fts5BufferAppendVarint(a,b,(i64)c) |
|
|
#define fts5BufferFree(a) sqlite3Fts5BufferFree(a) |
|
|
#define fts5BufferAppendBlob(a,b,c,d) sqlite3Fts5BufferAppendBlob(a,b,c,d) |
|
|
#define fts5BufferSet(a,b,c,d) sqlite3Fts5BufferSet(a,b,c,d) |
|
|
|
|
|
#define fts5BufferGrow(pRc,pBuf,nn) ( \ |
|
|
(u32)((pBuf)->n) + (u32)(nn) <= (u32)((pBuf)->nSpace) ? 0 : \ |
|
|
sqlite3Fts5BufferSize((pRc),(pBuf),(nn)+(pBuf)->n) \ |
|
|
) |
|
|
|
|
|
|
|
|
void sqlite3Fts5Put32(u8*, int); |
|
|
int sqlite3Fts5Get32(const u8*); |
|
|
|
|
|
#define FTS5_POS2COLUMN(iPos) (int)((iPos >> 32) & 0x7FFFFFFF) |
|
|
#define FTS5_POS2OFFSET(iPos) (int)(iPos & 0x7FFFFFFF) |
|
|
|
|
|
typedef struct Fts5PoslistReader Fts5PoslistReader; |
|
|
struct Fts5PoslistReader { |
|
|
|
|
|
const u8 *a; |
|
|
int n; |
|
|
int i; |
|
|
|
|
|
u8 bFlag; |
|
|
|
|
|
|
|
|
u8 bEof; |
|
|
i64 iPos; |
|
|
}; |
|
|
int sqlite3Fts5PoslistReaderInit( |
|
|
const u8 *a, int n, |
|
|
Fts5PoslistReader *pIter |
|
|
); |
|
|
int sqlite3Fts5PoslistReaderNext(Fts5PoslistReader*); |
|
|
|
|
|
typedef struct Fts5PoslistWriter Fts5PoslistWriter; |
|
|
struct Fts5PoslistWriter { |
|
|
i64 iPrev; |
|
|
}; |
|
|
int sqlite3Fts5PoslistWriterAppend(Fts5Buffer*, Fts5PoslistWriter*, i64); |
|
|
void sqlite3Fts5PoslistSafeAppend(Fts5Buffer*, i64*, i64); |
|
|
|
|
|
int sqlite3Fts5PoslistNext64( |
|
|
const u8 *a, int n, |
|
|
int *pi, |
|
|
i64 *piOff |
|
|
); |
|
|
|
|
|
|
|
|
void *sqlite3Fts5MallocZero(int *pRc, sqlite3_int64 nByte); |
|
|
char *sqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn); |
|
|
|
|
|
|
|
|
int sqlite3Fts5IsBareword(char t); |
|
|
|
|
|
|
|
|
|
|
|
typedef struct Fts5Termset Fts5Termset; |
|
|
int sqlite3Fts5TermsetNew(Fts5Termset**); |
|
|
int sqlite3Fts5TermsetAdd(Fts5Termset*, int, const char*, int, int *pbPresent); |
|
|
void sqlite3Fts5TermsetFree(Fts5Termset*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Fts5Index Fts5Index; |
|
|
typedef struct Fts5IndexIter Fts5IndexIter; |
|
|
|
|
|
struct Fts5IndexIter { |
|
|
i64 iRowid; |
|
|
const u8 *pData; |
|
|
int nData; |
|
|
u8 bEof; |
|
|
}; |
|
|
|
|
|
#define sqlite3Fts5IterEof(x) ((x)->bEof) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FTS5INDEX_QUERY_PREFIX 0x0001 |
|
|
#define FTS5INDEX_QUERY_DESC 0x0002 |
|
|
#define FTS5INDEX_QUERY_TEST_NOIDX 0x0004 |
|
|
#define FTS5INDEX_QUERY_SCAN 0x0008 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FTS5INDEX_QUERY_SKIPEMPTY 0x0010 |
|
|
#define FTS5INDEX_QUERY_NOOUTPUT 0x0020 |
|
|
#define FTS5INDEX_QUERY_SKIPHASH 0x0040 |
|
|
#define FTS5INDEX_QUERY_NOTOKENDATA 0x0080 |
|
|
#define FTS5INDEX_QUERY_SCANONETERM 0x0100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexOpen(Fts5Config *pConfig, int bCreate, Fts5Index**, char**); |
|
|
int sqlite3Fts5IndexClose(Fts5Index *p); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
u64 sqlite3Fts5IndexEntryCksum( |
|
|
i64 iRowid, |
|
|
int iCol, |
|
|
int iPos, |
|
|
int iIdx, |
|
|
const char *pTerm, |
|
|
int nTerm |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexCharlenToBytelen( |
|
|
const char *p, |
|
|
int nByte, |
|
|
int nChar |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexQuery( |
|
|
Fts5Index *p, |
|
|
const char *pToken, int nToken, |
|
|
int flags, |
|
|
Fts5Colset *pColset, |
|
|
Fts5IndexIter **ppIter |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IterNext(Fts5IndexIter*); |
|
|
int sqlite3Fts5IterNextFrom(Fts5IndexIter*, i64 iMatch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void sqlite3Fts5IterClose(Fts5IndexIter*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void sqlite3Fts5IndexCloseReader(Fts5Index*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *sqlite3Fts5IterTerm(Fts5IndexIter*, int*); |
|
|
int sqlite3Fts5IterNextScan(Fts5IndexIter*); |
|
|
void *sqlite3Fts5StructureRef(Fts5Index*); |
|
|
void sqlite3Fts5StructureRelease(void*); |
|
|
int sqlite3Fts5StructureTest(Fts5Index*, void*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IterToken(Fts5IndexIter*, i64, int, int, const char**, int*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexWrite( |
|
|
Fts5Index *p, |
|
|
int iCol, |
|
|
int iPos, |
|
|
const char *pToken, int nToken |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexBeginWrite( |
|
|
Fts5Index *p, |
|
|
int bDelete, |
|
|
i64 iDocid |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexSync(Fts5Index *p); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexRollback(Fts5Index *p); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize); |
|
|
int sqlite3Fts5IndexSetAverages(Fts5Index *p, const u8*, int); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexIntegrityCheck(Fts5Index*, u64 cksum, int bUseCksum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexInit(sqlite3*); |
|
|
|
|
|
int sqlite3Fts5IndexSetCookie(Fts5Index*, int); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexReads(Fts5Index *p); |
|
|
|
|
|
int sqlite3Fts5IndexReinit(Fts5Index *p); |
|
|
int sqlite3Fts5IndexOptimize(Fts5Index *p); |
|
|
int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge); |
|
|
int sqlite3Fts5IndexReset(Fts5Index *p); |
|
|
|
|
|
int sqlite3Fts5IndexLoadConfig(Fts5Index *p); |
|
|
|
|
|
int sqlite3Fts5IndexGetOrigin(Fts5Index *p, i64 *piOrigin); |
|
|
int sqlite3Fts5IndexContentlessDelete(Fts5Index *p, i64 iOrigin, i64 iRowid); |
|
|
|
|
|
void sqlite3Fts5IndexIterClearTokendata(Fts5IndexIter*); |
|
|
|
|
|
|
|
|
int sqlite3Fts5IndexIterWriteTokendata( |
|
|
Fts5IndexIter*, const char*, int, i64 iRowid, int iCol, int iOff |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v); |
|
|
int sqlite3Fts5GetVarintLen(u32 iVal); |
|
|
u8 sqlite3Fts5GetVarint(const unsigned char*, u64*); |
|
|
int sqlite3Fts5PutVarint(unsigned char *p, u64 v); |
|
|
|
|
|
#define fts5GetVarint32(a,b) sqlite3Fts5GetVarint32(a,(u32*)&(b)) |
|
|
#define fts5GetVarint sqlite3Fts5GetVarint |
|
|
|
|
|
#define fts5FastGetVarint32(a, iOff, nVal) { \ |
|
|
nVal = (a)[iOff++]; \ |
|
|
if( nVal & 0x80 ){ \ |
|
|
iOff--; \ |
|
|
iOff += fts5GetVarint32(&(a)[iOff], nVal); \ |
|
|
} \ |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Fts5Table Fts5Table; |
|
|
struct Fts5Table { |
|
|
sqlite3_vtab base; |
|
|
Fts5Config *pConfig; |
|
|
Fts5Index *pIndex; |
|
|
}; |
|
|
|
|
|
int sqlite3Fts5LoadTokenizer(Fts5Config *pConfig); |
|
|
|
|
|
Fts5Table *sqlite3Fts5TableFromCsrid(Fts5Global*, i64); |
|
|
|
|
|
int sqlite3Fts5FlushToDisk(Fts5Table*); |
|
|
|
|
|
void sqlite3Fts5ClearLocale(Fts5Config *pConfig); |
|
|
void sqlite3Fts5SetLocale(Fts5Config *pConfig, const char *pLoc, int nLoc); |
|
|
|
|
|
int sqlite3Fts5IsLocaleValue(Fts5Config *pConfig, sqlite3_value *pVal); |
|
|
int sqlite3Fts5DecodeLocaleValue(sqlite3_value *pVal, |
|
|
const char **ppText, int *pnText, const char **ppLoc, int *pnLoc |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Fts5Hash Fts5Hash; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5HashNew(Fts5Config*, Fts5Hash**, int *pnSize); |
|
|
void sqlite3Fts5HashFree(Fts5Hash*); |
|
|
|
|
|
int sqlite3Fts5HashWrite( |
|
|
Fts5Hash*, |
|
|
i64 iRowid, |
|
|
int iCol, |
|
|
int iPos, |
|
|
char bByte, |
|
|
const char *pToken, int nToken |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void sqlite3Fts5HashClear(Fts5Hash*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5HashIsEmpty(Fts5Hash*); |
|
|
|
|
|
int sqlite3Fts5HashQuery( |
|
|
Fts5Hash*, |
|
|
int nPre, |
|
|
const char *pTerm, int nTerm, |
|
|
void **ppObj, |
|
|
int *pnDoclist |
|
|
); |
|
|
|
|
|
int sqlite3Fts5HashScanInit( |
|
|
Fts5Hash*, |
|
|
const char *pTerm, int nTerm |
|
|
); |
|
|
void sqlite3Fts5HashScanNext(Fts5Hash*); |
|
|
int sqlite3Fts5HashScanEof(Fts5Hash*); |
|
|
void sqlite3Fts5HashScanEntry(Fts5Hash *, |
|
|
const char **pzTerm, |
|
|
int *pnTerm, |
|
|
const u8 **ppDoclist, |
|
|
int *pnDoclist |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define FTS5_STMT_SCAN_ASC 0 |
|
|
#define FTS5_STMT_SCAN_DESC 1 |
|
|
#define FTS5_STMT_LOOKUP 2 |
|
|
|
|
|
typedef struct Fts5Storage Fts5Storage; |
|
|
|
|
|
int sqlite3Fts5StorageOpen(Fts5Config*, Fts5Index*, int, Fts5Storage**, char**); |
|
|
int sqlite3Fts5StorageClose(Fts5Storage *p); |
|
|
int sqlite3Fts5StorageRename(Fts5Storage*, const char *zName); |
|
|
|
|
|
int sqlite3Fts5DropAll(Fts5Config*); |
|
|
int sqlite3Fts5CreateTable(Fts5Config*, const char*, const char*, int, char **); |
|
|
|
|
|
int sqlite3Fts5StorageDelete(Fts5Storage *p, i64, sqlite3_value**, int); |
|
|
int sqlite3Fts5StorageContentInsert(Fts5Storage *p, int, sqlite3_value**, i64*); |
|
|
int sqlite3Fts5StorageIndexInsert(Fts5Storage *p, sqlite3_value**, i64); |
|
|
|
|
|
int sqlite3Fts5StorageIntegrity(Fts5Storage *p, int iArg); |
|
|
|
|
|
int sqlite3Fts5StorageStmt(Fts5Storage *p, int eStmt, sqlite3_stmt**, char**); |
|
|
void sqlite3Fts5StorageStmtRelease(Fts5Storage *p, int eStmt, sqlite3_stmt*); |
|
|
|
|
|
int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol); |
|
|
int sqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnAvg); |
|
|
int sqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow); |
|
|
|
|
|
int sqlite3Fts5StorageSync(Fts5Storage *p); |
|
|
int sqlite3Fts5StorageRollback(Fts5Storage *p); |
|
|
|
|
|
int sqlite3Fts5StorageConfigValue( |
|
|
Fts5Storage *p, const char*, sqlite3_value*, int |
|
|
); |
|
|
|
|
|
int sqlite3Fts5StorageDeleteAll(Fts5Storage *p); |
|
|
int sqlite3Fts5StorageRebuild(Fts5Storage *p); |
|
|
int sqlite3Fts5StorageOptimize(Fts5Storage *p); |
|
|
int sqlite3Fts5StorageMerge(Fts5Storage *p, int nMerge); |
|
|
int sqlite3Fts5StorageReset(Fts5Storage *p); |
|
|
|
|
|
void sqlite3Fts5StorageReleaseDeleteRow(Fts5Storage*); |
|
|
int sqlite3Fts5StorageFindDeleteRow(Fts5Storage *p, i64 iDel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Fts5Expr Fts5Expr; |
|
|
typedef struct Fts5ExprNode Fts5ExprNode; |
|
|
typedef struct Fts5Parse Fts5Parse; |
|
|
typedef struct Fts5Token Fts5Token; |
|
|
typedef struct Fts5ExprPhrase Fts5ExprPhrase; |
|
|
typedef struct Fts5ExprNearset Fts5ExprNearset; |
|
|
|
|
|
struct Fts5Token { |
|
|
const char *p; |
|
|
int n; |
|
|
}; |
|
|
|
|
|
|
|
|
int sqlite3Fts5ExprNew( |
|
|
Fts5Config *pConfig, |
|
|
int bPhraseToAnd, |
|
|
int iCol, |
|
|
const char *zExpr, |
|
|
Fts5Expr **ppNew, |
|
|
char **pzErr |
|
|
); |
|
|
int sqlite3Fts5ExprPattern( |
|
|
Fts5Config *pConfig, |
|
|
int bGlob, |
|
|
int iCol, |
|
|
const char *zText, |
|
|
Fts5Expr **pp |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5ExprFirst(Fts5Expr*, Fts5Index *pIdx, i64 iMin, int bDesc); |
|
|
int sqlite3Fts5ExprNext(Fts5Expr*, i64 iMax); |
|
|
int sqlite3Fts5ExprEof(Fts5Expr*); |
|
|
i64 sqlite3Fts5ExprRowid(Fts5Expr*); |
|
|
|
|
|
void sqlite3Fts5ExprFree(Fts5Expr*); |
|
|
int sqlite3Fts5ExprAnd(Fts5Expr **pp1, Fts5Expr *p2); |
|
|
|
|
|
|
|
|
int sqlite3Fts5ExprInit(Fts5Global*, sqlite3*); |
|
|
|
|
|
int sqlite3Fts5ExprPhraseCount(Fts5Expr*); |
|
|
int sqlite3Fts5ExprPhraseSize(Fts5Expr*, int iPhrase); |
|
|
int sqlite3Fts5ExprPoslist(Fts5Expr*, int, const u8 **); |
|
|
|
|
|
typedef struct Fts5PoslistPopulator Fts5PoslistPopulator; |
|
|
Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr*, int); |
|
|
int sqlite3Fts5ExprPopulatePoslists( |
|
|
Fts5Config*, Fts5Expr*, Fts5PoslistPopulator*, int, const char*, int |
|
|
); |
|
|
void sqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64); |
|
|
|
|
|
int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); |
|
|
|
|
|
int sqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *); |
|
|
|
|
|
int sqlite3Fts5ExprQueryToken(Fts5Expr*, int, int, const char**, int*); |
|
|
int sqlite3Fts5ExprInstToken(Fts5Expr*, i64, int, int, int, int, const char**, int*); |
|
|
void sqlite3Fts5ExprClearTokens(Fts5Expr*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...); |
|
|
|
|
|
Fts5ExprNode *sqlite3Fts5ParseNode( |
|
|
Fts5Parse *pParse, |
|
|
int eType, |
|
|
Fts5ExprNode *pLeft, |
|
|
Fts5ExprNode *pRight, |
|
|
Fts5ExprNearset *pNear |
|
|
); |
|
|
|
|
|
Fts5ExprNode *sqlite3Fts5ParseImplicitAnd( |
|
|
Fts5Parse *pParse, |
|
|
Fts5ExprNode *pLeft, |
|
|
Fts5ExprNode *pRight |
|
|
); |
|
|
|
|
|
Fts5ExprPhrase *sqlite3Fts5ParseTerm( |
|
|
Fts5Parse *pParse, |
|
|
Fts5ExprPhrase *pPhrase, |
|
|
Fts5Token *pToken, |
|
|
int bPrefix |
|
|
); |
|
|
|
|
|
void sqlite3Fts5ParseSetCaret(Fts5ExprPhrase*); |
|
|
|
|
|
Fts5ExprNearset *sqlite3Fts5ParseNearset( |
|
|
Fts5Parse*, |
|
|
Fts5ExprNearset*, |
|
|
Fts5ExprPhrase* |
|
|
); |
|
|
|
|
|
Fts5Colset *sqlite3Fts5ParseColset( |
|
|
Fts5Parse*, |
|
|
Fts5Colset*, |
|
|
Fts5Token * |
|
|
); |
|
|
|
|
|
void sqlite3Fts5ParsePhraseFree(Fts5ExprPhrase*); |
|
|
void sqlite3Fts5ParseNearsetFree(Fts5ExprNearset*); |
|
|
void sqlite3Fts5ParseNodeFree(Fts5ExprNode*); |
|
|
|
|
|
void sqlite3Fts5ParseSetDistance(Fts5Parse*, Fts5ExprNearset*, Fts5Token*); |
|
|
void sqlite3Fts5ParseSetColset(Fts5Parse*, Fts5ExprNode*, Fts5Colset*); |
|
|
Fts5Colset *sqlite3Fts5ParseColsetInvert(Fts5Parse*, Fts5Colset*); |
|
|
void sqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p); |
|
|
void sqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5AuxInit(fts5_api*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5TokenizerInit(fts5_api*); |
|
|
int sqlite3Fts5TokenizerPattern( |
|
|
int (*xCreate)(void*, const char**, int, Fts5Tokenizer**), |
|
|
Fts5Tokenizer *pTok |
|
|
); |
|
|
int sqlite3Fts5TokenizerPreload(Fts5TokenizerConfig*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5VocabInit(Fts5Global*, sqlite3*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sqlite3Fts5UnicodeIsdiacritic(int c); |
|
|
int sqlite3Fts5UnicodeFold(int c, int bRemoveDiacritic); |
|
|
|
|
|
int sqlite3Fts5UnicodeCatParse(const char*, u8*); |
|
|
int sqlite3Fts5UnicodeCategory(u32 iCode); |
|
|
void sqlite3Fts5UnicodeAscii(u8*, u8*); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|