fts3.c File Reference

Go to the source code of this file.

Classes

struct  DataBuffer
struct  StringBuffer
struct  DLReader
struct  DLWriter
struct  PLReader
struct  PLWriter
struct  DLCollector
struct  OrderedDLReader
struct  QueryTerm
struct  Query
struct  Snippet
struct  Snippet::snippetMatch
struct  fulltext_vtab
struct  fulltext_cursor
struct  FtsToken
struct  TableSpec
struct  InteriorBlock
struct  InteriorWriter
struct  InteriorReader
struct  LeafWriter
struct  LeafReader
struct  LeavesReader
struct  TermData
struct  OptLeavesReader

Defines

#define FTSTRACE(A)
#define SQLITE_FTS3_DEFAULT_NEAR_PARAM   10
#define MERGE_COUNT   16
#define CLEAR(b)   memset(b, '\0', sizeof(*(b)))
#define SCRAMBLE(b)
#define VARINT_MAX   10
#define ASSERT_VALID_DOCLIST(i, p, n, o)   assert( 1 )
#define LEAF_SELECT   "select block from %_segments where blockid between ? and ? order by blockid"
#define kPendingThreshold   (1*1024*1024)
#define TOKEN_EOF   0
#define TOKEN_SPACE   1
#define TOKEN_ID   2
#define TOKEN_STRING   3
#define TOKEN_PUNCT   4
#define ftsIdChar(C)   (((c=C)&0x80)!=0 || (c>0x1f && isFtsIdChar[c-0x20]))
#define FTS3_ROTOR_SZ   (32)
#define FTS3_ROTOR_MASK   (FTS3_ROTOR_SZ-1)
#define SNIPPET_IGNORE   0
#define SNIPPET_DESIRED   1
#define INTERIOR_MAX   2048
#define INTERIOR_MIN_TERMS   7
#define ROOT_MAX   1024
#define ASSERT_VALID_INTERIOR_BLOCK(x)   assert( 1 )
#define STANDALONE_MIN   1024
#define LEAF_MAX   2048
#define ASSERT_VALID_LEAF_NODE(p, n)   assert( 1 )

Typedefs

typedef struct fulltext_vtab fulltext_vtab

Enumerations

enum  DocListType {
  DL_DOCIDS, DL_POSITIONS, DL_POSITIONS_OFFSETS, DL_DOCIDS,
  DL_POSITIONS, DL_POSITIONS_OFFSETS, DL_DOCIDS, DL_POSITIONS,
  DL_POSITIONS_OFFSETS
}
enum  { POS_END = 0, POS_COLUMN, POS_BASE }
enum  QueryType {
  QUERY_GENERIC, QUERY_ROWID, QUERY_FULLTEXT, QUERY_GENERIC,
  QUERY_ROWID, QUERY_FULLTEXT, QUERY_GENERIC, QUERY_DOCID,
  QUERY_FULLTEXT
}
enum  fulltext_statement {
  CONTENT_INSERT_STMT, CONTENT_SELECT_STMT, CONTENT_UPDATE_STMT, CONTENT_DELETE_STMT,
  TERM_SELECT_STMT, TERM_SELECT_ALL_STMT, TERM_INSERT_STMT, TERM_UPDATE_STMT,
  TERM_DELETE_STMT, MAX_STMT, CONTENT_INSERT_STMT, CONTENT_SELECT_STMT,
  CONTENT_UPDATE_STMT, CONTENT_DELETE_STMT, CONTENT_EXISTS_STMT, BLOCK_INSERT_STMT,
  BLOCK_SELECT_STMT, BLOCK_DELETE_STMT, BLOCK_DELETE_ALL_STMT, SEGDIR_MAX_INDEX_STMT,
  SEGDIR_SET_STMT, SEGDIR_SELECT_LEVEL_STMT, SEGDIR_SPAN_STMT, SEGDIR_DELETE_STMT,
  SEGDIR_SELECT_SEGMENT_STMT, SEGDIR_SELECT_ALL_STMT, SEGDIR_DELETE_ALL_STMT, SEGDIR_COUNT_STMT,
  MAX_STMT, CONTENT_INSERT_STMT, CONTENT_SELECT_STMT, CONTENT_UPDATE_STMT,
  CONTENT_DELETE_STMT, CONTENT_EXISTS_STMT, BLOCK_INSERT_STMT, BLOCK_SELECT_STMT,
  BLOCK_DELETE_STMT, BLOCK_DELETE_ALL_STMT, SEGDIR_MAX_INDEX_STMT, SEGDIR_SET_STMT,
  SEGDIR_SELECT_LEVEL_STMT, SEGDIR_SPAN_STMT, SEGDIR_DELETE_STMT, SEGDIR_SELECT_SEGMENT_STMT,
  SEGDIR_SELECT_ALL_STMT, SEGDIR_DELETE_ALL_STMT, SEGDIR_COUNT_STMT, MAX_STMT
}

Functions

static int safe_isspace (char c)
static int safe_tolower (char c)
static int safe_isalnum (char c)
static int fts3PutVarint (char *p, sqlite_int64 v)
static int fts3GetVarint (const char *p, sqlite_int64 *v)
static int fts3GetVarint32 (const char *p, int *pi)
static void dataBufferInit (DataBuffer *pBuffer, int nCapacity)
static void dataBufferReset (DataBuffer *pBuffer)
static void dataBufferDestroy (DataBuffer *pBuffer)
static void dataBufferSwap (DataBuffer *pBuffer1, DataBuffer *pBuffer2)
static void dataBufferExpand (DataBuffer *pBuffer, int nAddCapacity)
static void dataBufferAppend (DataBuffer *pBuffer, const char *pSource, int nSource)
static void dataBufferAppend2 (DataBuffer *pBuffer, const char *pSource1, int nSource1, const char *pSource2, int nSource2)
static void dataBufferReplace (DataBuffer *pBuffer, const char *pSource, int nSource)
static void initStringBuffer (StringBuffer *sb)
static int stringBufferLength (StringBuffer *sb)
static char * stringBufferData (StringBuffer *sb)
static void stringBufferDestroy (StringBuffer *sb)
static void nappend (StringBuffer *sb, const char *zFrom, int nFrom)
static void append (StringBuffer *sb, const char *zFrom)
static void appendList (StringBuffer *sb, int nString, char **azString)
static int endsInWhiteSpace (StringBuffer *p)
static void appendWhiteSpace (StringBuffer *p)
static void trimWhiteSpace (StringBuffer *p)
static int dlrAtEnd (DLReader *pReader)
static sqlite_int64 dlrDocid (DLReader *pReader)
static const char * dlrDocData (DLReader *pReader)
static int dlrDocDataBytes (DLReader *pReader)
static int dlrAllDataBytes (DLReader *pReader)
static const char * dlrPosData (DLReader *pReader)
static int dlrPosDataLen (DLReader *pReader)
static void dlrStep (DLReader *pReader)
static void dlrInit (DLReader *pReader, DocListType iType, const char *pData, int nData)
static void dlrDestroy (DLReader *pReader)
static void dlwInit (DLWriter *pWriter, DocListType iType, DataBuffer *b)
static void dlwDestroy (DLWriter *pWriter)
static void dlwAppend (DLWriter *pWriter, const char *pData, int nData, sqlite_int64 iFirstDocid, sqlite_int64 iLastDocid)
static void dlwCopy (DLWriter *pWriter, DLReader *pReader)
static void dlwAdd (DLWriter *pWriter, sqlite_int64 iDocid)
static int plrAtEnd (PLReader *pReader)
static int plrColumn (PLReader *pReader)
static int plrPosition (PLReader *pReader)
static int plrStartOffset (PLReader *pReader)
static int plrEndOffset (PLReader *pReader)
static void plrStep (PLReader *pReader)
static void plrInit (PLReader *pReader, DLReader *pDLReader)
static void plrDestroy (PLReader *pReader)
static void plwAdd (PLWriter *pWriter, int iColumn, int iPos, int iStartOffset, int iEndOffset)
static void plwCopy (PLWriter *pWriter, PLReader *pReader)
static void plwInit (PLWriter *pWriter, DLWriter *dlw, sqlite_int64 iDocid)
static void plwTerminate (PLWriter *pWriter)
static void plwDestroy (PLWriter *pWriter)
static void dlcAddDoclist (DLCollector *pCollector, DataBuffer *b)
static void dlcNext (DLCollector *pCollector, sqlite_int64 iDocid)
static void dlcAddPos (DLCollector *pCollector, int iColumn, int iPos, int iStartOffset, int iEndOffset)
static DLCollectordlcNew (sqlite_int64 iDocid, DocListType iType)
static void dlcDelete (DLCollector *pCollector)
static void docListTrim (DocListType iType, const char *pData, int nData, int iColumn, DocListType iOutType, DataBuffer *out)
static int orderedDLReaderCmp (OrderedDLReader *r1, OrderedDLReader *r2)
static void orderedDLReaderReorder (OrderedDLReader *p, int n)
static void docListMerge (DataBuffer *out, DLReader *pReaders, int nReaders)
static int posListCmp (PLReader *pLeft, PLReader *pRight)
static void posListUnion (DLReader *pLeft, DLReader *pRight, DLWriter *pOut)
static void docListUnion (const char *pLeft, int nLeft, const char *pRight, int nRight, DataBuffer *pOut)
static void posListPhraseMerge (DLReader *pLeft, DLReader *pRight, int nNear, int isSaveLeft, DLWriter *pOut)
static int plrCompare (PLReader *pLeft, PLReader *pRight)
static void docListPhraseMerge (const char *pLeft, int nLeft, const char *pRight, int nRight, int nNear, int nPhrase, DocListType iType, DataBuffer *pOut)
static void docListAndMerge (const char *pLeft, int nLeft, const char *pRight, int nRight, DataBuffer *pOut)
static void docListOrMerge (const char *pLeft, int nLeft, const char *pRight, int nRight, DataBuffer *pOut)
static void docListExceptMerge (const char *pLeft, int nLeft, const char *pRight, int nRight, DataBuffer *pOut)
static char * string_dup_n (const char *s, int n)
static char * string_dup (const char *s)
static char * string_format (const char *zFormat, const char *zDb, const char *zName)
static int sql_exec (sqlite3 *db, const char *zDb, const char *zName, const char *zFormat)
static int sql_prepare (sqlite3 *db, const char *zDb, const char *zName, sqlite3_stmt **ppStmt, const char *zFormat)
static struct fulltext_vtabcursor_vtab (fulltext_cursor *c)
static const char * contentInsertStatement (fulltext_vtab *v)
static const char * contentSelectStatement (fulltext_vtab *v)
static const char * contentUpdateStatement (fulltext_vtab *v)
static int sql_get_statement (fulltext_vtab *v, fulltext_statement iStmt, sqlite3_stmt **ppStmt)
static int sql_single_step (sqlite3_stmt *s)
static int sql_get_leaf_statement (fulltext_vtab *v, int idx, sqlite3_stmt **ppStmt)
static int content_insert (fulltext_vtab *v, sqlite3_value *docid, sqlite3_value **pValues)
static int content_update (fulltext_vtab *v, sqlite3_value **pValues, sqlite_int64 iDocid)
static void freeStringArray (int nString, const char **pString)
static int content_select (fulltext_vtab *v, sqlite_int64 iDocid, const char ***pValues)
static int content_delete (fulltext_vtab *v, sqlite_int64 iDocid)
static int content_exists (fulltext_vtab *v)
static int block_insert (fulltext_vtab *v, const char *pData, int nData, sqlite_int64 *piBlockid)
static int block_delete (fulltext_vtab *v, sqlite_int64 iStartBlockid, sqlite_int64 iEndBlockid)
static int segdir_max_index (fulltext_vtab *v, int iLevel, int *pidx)
static int segdir_set (fulltext_vtab *v, int iLevel, int idx, sqlite_int64 iStartBlockid, sqlite_int64 iLeavesEndBlockid, sqlite_int64 iEndBlockid, const char *pRootData, int nRootData)
static int segdir_span (fulltext_vtab *v, int iLevel, sqlite_int64 *piStartBlockid, sqlite_int64 *piEndBlockid)
static int segdir_delete (fulltext_vtab *v, int iLevel)
static int segdir_delete_all (fulltext_vtab *v)
static int segdir_count (fulltext_vtab *v, int *pnSegments, int *piMaxLevel)
static int clearPendingTerms (fulltext_vtab *v)
static void fulltext_vtab_destroy (fulltext_vtab *v)
static int ftsGetToken (const char *z, int *tokenType)
static char ** tokenizeString (const char *z, int *pnToken)
static void dequoteString (char *z)
static void tokenListToIdList (char **azIn)
static char * firstToken (char *zIn, char **pzTail)
static int startsWith (const char *s, const char *t)
static void clearTableSpec (TableSpec *p)
static int parseSpec (TableSpec *pSpec, int argc, const char *const *argv, char **pzErr)
static char * fulltextSchema (int nColumn, const char *const *azColumn, const char *zTableName)
static int constructVtab (sqlite3 *db, fts3Hash *pHash, TableSpec *spec, sqlite3_vtab **ppVTab, char **pzErr)
static int fulltextConnect (sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlite3_vtab **ppVTab, char **pzErr)
static int fulltextCreate (sqlite3 *db, void *pAux, int argc, const char *const *argv, sqlite3_vtab **ppVTab, char **pzErr)
static int fulltextBestIndex (sqlite3_vtab *pVTab, sqlite3_index_info *pInfo)
static int fulltextDisconnect (sqlite3_vtab *pVTab)
static int fulltextDestroy (sqlite3_vtab *pVTab)
static int fulltextOpen (sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor)
static void queryClear (Query *q)
static void snippetClear (Snippet *p)
static void snippetAppendMatch (Snippet *p, int iCol, int iTerm, int iToken, int iStart, int nByte)
static void snippetOffsetsOfColumn (Query *pQuery, Snippet *pSnippet, int iColumn, const char *zDoc, int nDoc)
static void trimSnippetOffsetsForNear (Query *pQuery, Snippet *pSnippet)
static void snippetAllOffsets (fulltext_cursor *p)
static void snippetOffsetText (Snippet *p)
static int wordBoundary (int iBreak, const char *zDoc, int nDoc, struct snippetMatch *aMatch, int nMatch, int iCol)
static void snippetText (fulltext_cursor *pCursor, const char *zStartMark, const char *zEndMark, const char *zEllipsis)
static int fulltextClose (sqlite3_vtab_cursor *pCursor)
static int fulltextNext (sqlite3_vtab_cursor *pCursor)
static int termSelect (fulltext_vtab *v, int iColumn, const char *pTerm, int nTerm, int isPrefix, DocListType iType, DataBuffer *out)
static int docListOfTerm (fulltext_vtab *v, int iColumn, QueryTerm *pQTerm, DataBuffer *pResult)
static void queryAdd (Query *q, const char *pTerm, int nTerm)
static int checkColumnSpecifier (fulltext_vtab *pVtab, const char *zToken, int nToken)
static int tokenizeSegment (sqlite3_tokenizer *pTokenizer, const char *zSegment, int nSegment, int inPhrase, Query *pQuery)
static int parseQuery (fulltext_vtab *v, const char *zInput, int nInput, int dfltColumn, Query *pQuery)
static int flushPendingTerms (fulltext_vtab *v)
static int fulltextQuery (fulltext_vtab *v, int iColumn, const char *zInput, int nInput, DataBuffer *pResult, Query *pQuery)
static int fulltextFilter (sqlite3_vtab_cursor *pCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv)
static int fulltextEof (sqlite3_vtab_cursor *pCursor)
static int fulltextColumn (sqlite3_vtab_cursor *pCursor, sqlite3_context *pContext, int idxCol)
static int fulltextRowid (sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid)
static int buildTerms (fulltext_vtab *v, sqlite_int64 iDocid, const char *zText, int iColumn)
static int insertTerms (fulltext_vtab *v, sqlite_int64 iDocid, sqlite3_value **pValues)
static int deleteTerms (fulltext_vtab *v, sqlite_int64 iDocid)
static int initPendingTerms (fulltext_vtab *v, sqlite_int64 iDocid)
static int index_insert (fulltext_vtab *v, sqlite3_value *pRequestDocid, sqlite3_value **pValues, sqlite_int64 *piDocid)
static int index_delete (fulltext_vtab *v, sqlite_int64 iRow)
static int index_update (fulltext_vtab *v, sqlite_int64 iRow, sqlite3_value **pValues)
static InteriorBlockinteriorBlockNew (int iHeight, sqlite_int64 iChildBlock, const char *pTerm, int nTerm)
static void interiorWriterInit (int iHeight, const char *pTerm, int nTerm, sqlite_int64 iChildBlock, InteriorWriter *pWriter)
static void interiorWriterAppend (InteriorWriter *pWriter, const char *pTerm, int nTerm, sqlite_int64 iChildBlock)
static int interiorWriterDestroy (InteriorWriter *pWriter)
static int interiorWriterRootInfo (fulltext_vtab *v, InteriorWriter *pWriter, char **ppRootInfo, int *pnRootInfo, sqlite_int64 *piEndBlockid)
static void interiorReaderDestroy (InteriorReader *pReader)
static void interiorReaderInit (const char *pData, int nData, InteriorReader *pReader)
static int interiorReaderAtEnd (InteriorReader *pReader)
static sqlite_int64 interiorReaderCurrentBlockid (InteriorReader *pReader)
static int interiorReaderTermBytes (InteriorReader *pReader)
static const char * interiorReaderTerm (InteriorReader *pReader)
static void interiorReaderStep (InteriorReader *pReader)
static int interiorReaderTermCmp (InteriorReader *pReader, const char *pTerm, int nTerm, int isPrefix)
static void leafWriterInit (int iLevel, int idx, LeafWriter *pWriter)
static int leafWriterInternalFlush (fulltext_vtab *v, LeafWriter *pWriter, int iData, int nData)
static int leafWriterFlush (fulltext_vtab *v, LeafWriter *pWriter)
static int leafWriterRootInfo (fulltext_vtab *v, LeafWriter *pWriter, char **ppRootInfo, int *pnRootInfo, sqlite_int64 *piEndBlockid)
static int leafWriterFinalize (fulltext_vtab *v, LeafWriter *pWriter)
static void leafWriterDestroy (LeafWriter *pWriter)
static int leafWriterEncodeTerm (LeafWriter *pWriter, const char *pTerm, int nTerm)
static int leafWriterInlineFlush (fulltext_vtab *v, LeafWriter *pWriter, const char *pTerm, int nTerm, int iDoclistData)
static int leafWriterStepMerge (fulltext_vtab *v, LeafWriter *pWriter, const char *pTerm, int nTerm, DLReader *pReaders, int nReaders)
static int leafWriterStep (fulltext_vtab *v, LeafWriter *pWriter, const char *pTerm, int nTerm, const char *pData, int nData)
static void leafReaderDestroy (LeafReader *pReader)
static int leafReaderAtEnd (LeafReader *pReader)
static int leafReaderTermBytes (LeafReader *pReader)
static const char * leafReaderTerm (LeafReader *pReader)
static int leafReaderDataBytes (LeafReader *pReader)
static const char * leafReaderData (LeafReader *pReader)
static void leafReaderInit (const char *pData, int nData, LeafReader *pReader)
static void leafReaderStep (LeafReader *pReader)
static int leafReaderTermCmp (LeafReader *pReader, const char *pTerm, int nTerm, int isPrefix)
static int leavesReaderTermBytes (LeavesReader *pReader)
static const char * leavesReaderTerm (LeavesReader *pReader)
static int leavesReaderDataBytes (LeavesReader *pReader)
static const char * leavesReaderData (LeavesReader *pReader)
static int leavesReaderAtEnd (LeavesReader *pReader)
static int leavesReaderReset (LeavesReader *pReader)
static void leavesReaderDestroy (LeavesReader *pReader)
static int leavesReaderInit (fulltext_vtab *v, int idx, sqlite_int64 iStartBlockid, sqlite_int64 iEndBlockid, const char *pRootData, int nRootData, LeavesReader *pReader)
static int leavesReaderStep (fulltext_vtab *v, LeavesReader *pReader)
static int leavesReaderTermCmp (LeavesReader *lr1, LeavesReader *lr2)
static int leavesReaderCmp (LeavesReader *lr1, LeavesReader *lr2)
static void leavesReaderReorder (LeavesReader *pLr, int nLr)
static int leavesReadersInit (fulltext_vtab *v, int iLevel, LeavesReader *pReaders, int *piReaders)
static int leavesReadersMerge (fulltext_vtab *v, LeavesReader *pReaders, int nReaders, LeafWriter *pWriter)
static int segmentMerge (fulltext_vtab *v, int iLevel)
static int segdirNextIndex (fulltext_vtab *v, int iLevel, int *pidx)
static void docListAccumulateUnion (DataBuffer *acc, const char *pData, int nData)
static int loadSegmentLeavesInt (fulltext_vtab *v, LeavesReader *pReader, const char *pTerm, int nTerm, int isPrefix, DataBuffer *out)
static int loadSegmentLeaf (fulltext_vtab *v, const char *pData, int nData, const char *pTerm, int nTerm, int isPrefix, DataBuffer *out)
static int loadSegmentLeaves (fulltext_vtab *v, sqlite_int64 iStartLeaf, sqlite_int64 iEndLeaf, const char *pTerm, int nTerm, int isPrefix, DataBuffer *out)
static void getChildrenContaining (const char *pData, int nData, const char *pTerm, int nTerm, int isPrefix, sqlite_int64 *piStartChild, sqlite_int64 *piEndChild)
static int loadAndGetChildrenContaining (fulltext_vtab *v, sqlite_int64 iBlockid, const char *pTerm, int nTerm, int isPrefix, sqlite_int64 *piStartChild, sqlite_int64 *piEndChild)
static int loadSegmentInt (fulltext_vtab *v, const char *pData, int nData, sqlite_int64 iLeavesEnd, const char *pTerm, int nTerm, int isPrefix, DataBuffer *out)
static int loadSegment (fulltext_vtab *v, const char *pData, int nData, sqlite_int64 iLeavesEnd, const char *pTerm, int nTerm, int isPrefix, DataBuffer *out)
static int termDataCmp (const void *av, const void *bv)
static int writeZeroSegment (fulltext_vtab *v, fts3Hash *pTerms)
static int fulltextUpdate (sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg, sqlite_int64 *pRowid)
static int fulltextSync (sqlite3_vtab *pVtab)
static int fulltextBegin (sqlite3_vtab *pVtab)
static int fulltextCommit (sqlite3_vtab *pVtab)
static int fulltextRollback (sqlite3_vtab *pVtab)
static void snippetFunc (sqlite3_context *pContext, int argc, sqlite3_value **argv)
static void snippetOffsetsFunc (sqlite3_context *pContext, int argc, sqlite3_value **argv)
static int optLeavesReaderAtEnd (OptLeavesReader *pReader)
static int optLeavesReaderTermBytes (OptLeavesReader *pReader)
static const char * optLeavesReaderData (OptLeavesReader *pReader)
static int optLeavesReaderDataBytes (OptLeavesReader *pReader)
static const char * optLeavesReaderTerm (OptLeavesReader *pReader)
static int optLeavesReaderStep (fulltext_vtab *v, OptLeavesReader *pReader)
static int optLeavesReaderTermCmp (OptLeavesReader *lr1, OptLeavesReader *lr2)
static int optLeavesReaderCmp (OptLeavesReader *lr1, OptLeavesReader *lr2)
static void optLeavesReaderReorder (OptLeavesReader *pLr, int nLr)
static int optimizeInternal (fulltext_vtab *v, OptLeavesReader *readers, int nReaders, LeafWriter *pWriter)
static void optimizeFunc (sqlite3_context *pContext, int argc, sqlite3_value **argv)
static int fulltextFindFunction (sqlite3_vtab *pVtab, int nArg, const char *zName, void(**pxFunc)(sqlite3_context *, int, sqlite3_value **), void **ppArg)
static int fulltextRename (sqlite3_vtab *pVtab, const char *zName)
static void hashDestroy (void *p)
void sqlite3Fts3SimpleTokenizerModule (sqlite3_tokenizer_module const **ppModule)
void sqlite3Fts3PorterTokenizerModule (sqlite3_tokenizer_module const **ppModule)
void sqlite3Fts3IcuTokenizerModule (sqlite3_tokenizer_module const **ppModule)
int sqlite3Fts3InitHashTable (sqlite3 *, fts3Hash *, const char *)
int sqlite3Fts3Init (sqlite3 *db)
int sqlite3_extension_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi)

Variables

static const char *const fulltext_zStatement [MAX_STMT]
static const sqlite3_module fts3Module
static const char isFtsIdChar []

Define Documentation

#define ASSERT_VALID_DOCLIST ( i,
p,
n,
 )     assert( 1 )

Definition at line 720 of file fts3.c.

#define ASSERT_VALID_INTERIOR_BLOCK (  )     assert( 1 )

Definition at line 4491 of file fts3.c.

#define ASSERT_VALID_LEAF_NODE ( p,
 )     assert( 1 )

Definition at line 4894 of file fts3.c.

#define CLEAR (  )     memset(b, '\0', sizeof(*(b)))

Definition at line 379 of file fts3.c.

#define FTS3_ROTOR_MASK   (FTS3_ROTOR_SZ-1)

Definition at line 3234 of file fts3.c.

Referenced by snippetOffsetsOfColumn().

#define FTS3_ROTOR_SZ   (32)

Definition at line 3233 of file fts3.c.

Referenced by snippetOffsetsOfColumn().

#define ftsIdChar (  )     (((c=C)&0x80)!=0 || (c>0x1f && isFtsIdChar[c-0x20]))

Definition at line 2579 of file fts3.c.

Referenced by ftsGetToken().

#define FTSTRACE (  ) 
#define INTERIOR_MAX   2048

Definition at line 4377 of file fts3.c.

#define INTERIOR_MIN_TERMS   7

Definition at line 4384 of file fts3.c.

#define kPendingThreshold   (1*1024*1024)

Definition at line 2010 of file fts3.c.

#define LEAF_MAX   2048

Definition at line 4798 of file fts3.c.

#define LEAF_SELECT   "select block from %_segments where blockid between ? and ? order by blockid"

Definition at line 1996 of file fts3.c.

#define MERGE_COUNT   16

Definition at line 367 of file fts3.c.

#define ROOT_MAX   1024

Definition at line 4397 of file fts3.c.

#define SCRAMBLE (  ) 

Definition at line 384 of file fts3.c.

#define SNIPPET_DESIRED   1

Definition at line 3523 of file fts3.c.

#define SNIPPET_IGNORE   0

Definition at line 3522 of file fts3.c.

#define SQLITE_FTS3_DEFAULT_NEAR_PARAM   10

Definition at line 318 of file fts3.c.

Referenced by tokenizeSegment().

#define STANDALONE_MIN   1024

Definition at line 4795 of file fts3.c.

#define TOKEN_EOF   0

Definition at line 2551 of file fts3.c.

#define TOKEN_ID   2

Definition at line 2553 of file fts3.c.

#define TOKEN_PUNCT   4

Definition at line 2555 of file fts3.c.

#define TOKEN_SPACE   1

Definition at line 2552 of file fts3.c.

#define TOKEN_STRING   3

Definition at line 2554 of file fts3.c.

#define VARINT_MAX   10

Definition at line 388 of file fts3.c.


Typedef Documentation

typedef struct fulltext_vtab fulltext_vtab

Definition at line 1789 of file fts3.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
POS_END 
POS_COLUMN 
POS_BASE 

Definition at line 358 of file fts3.c.

Enumerator:
DL_DOCIDS 
DL_POSITIONS 
DL_POSITIONS_OFFSETS 
DL_DOCIDS 
DL_POSITIONS 
DL_POSITIONS_OFFSETS 
DL_DOCIDS 
DL_POSITIONS 
DL_POSITIONS_OFFSETS 

Definition at line 339 of file fts3.c.

Enumerator:
CONTENT_INSERT_STMT 
CONTENT_SELECT_STMT 
CONTENT_UPDATE_STMT 
CONTENT_DELETE_STMT 
TERM_SELECT_STMT 
TERM_SELECT_ALL_STMT 
TERM_INSERT_STMT 
TERM_UPDATE_STMT 
TERM_DELETE_STMT 
MAX_STMT 
CONTENT_INSERT_STMT 
CONTENT_SELECT_STMT 
CONTENT_UPDATE_STMT 
CONTENT_DELETE_STMT 
CONTENT_EXISTS_STMT 
BLOCK_INSERT_STMT 
BLOCK_SELECT_STMT 
BLOCK_DELETE_STMT 
BLOCK_DELETE_ALL_STMT 
SEGDIR_MAX_INDEX_STMT 
SEGDIR_SET_STMT 
SEGDIR_SELECT_LEVEL_STMT 
SEGDIR_SPAN_STMT 
SEGDIR_DELETE_STMT 
SEGDIR_SELECT_SEGMENT_STMT 
SEGDIR_SELECT_ALL_STMT 
SEGDIR_DELETE_ALL_STMT 
SEGDIR_COUNT_STMT 
MAX_STMT 
CONTENT_INSERT_STMT 
CONTENT_SELECT_STMT 
CONTENT_UPDATE_STMT 
CONTENT_DELETE_STMT 
CONTENT_EXISTS_STMT 
BLOCK_INSERT_STMT 
BLOCK_SELECT_STMT 
BLOCK_DELETE_STMT 
BLOCK_DELETE_ALL_STMT 
SEGDIR_MAX_INDEX_STMT 
SEGDIR_SET_STMT 
SEGDIR_SELECT_LEVEL_STMT 
SEGDIR_SPAN_STMT 
SEGDIR_DELETE_STMT 
SEGDIR_SELECT_SEGMENT_STMT 
SEGDIR_SELECT_ALL_STMT 
SEGDIR_DELETE_ALL_STMT 
SEGDIR_COUNT_STMT 
MAX_STMT 

Definition at line 1903 of file fts3.c.

enum QueryType
Enumerator:
QUERY_GENERIC 
QUERY_ROWID 
QUERY_FULLTEXT 
QUERY_GENERIC 
QUERY_ROWID 
QUERY_FULLTEXT 
QUERY_GENERIC 
QUERY_DOCID 
QUERY_FULLTEXT 

Definition at line 1897 of file fts3.c.


Function Documentation

static void append ( StringBuffer sb,
const char *  zFrom 
) [static]
static void appendList ( StringBuffer sb,
int  nString,
char **  azString 
) [static]

Definition at line 535 of file fts3.c.

References append().

Referenced by contentInsertStatement(), contentSelectStatement(), fulltextCreate(), and fulltextFilter().

static void appendWhiteSpace ( StringBuffer p  )  [static]

Definition at line 551 of file fts3.c.

References append(), endsInWhiteSpace(), and stringBufferLength().

Referenced by snippetText().

static int block_delete ( fulltext_vtab v,
sqlite_int64  iStartBlockid,
sqlite_int64  iEndBlockid 
) [static]

Definition at line 2309 of file fts3.c.

References BLOCK_DELETE_STMT, sql_get_statement(), sql_single_step(), sqlite3_bind_int64(), and SQLITE_OK.

Referenced by segdir_delete().

static int block_insert ( fulltext_vtab v,
const char *  pData,
int  nData,
sqlite_int64 piBlockid 
) [static]
static int buildTerms ( fulltext_vtab v,
sqlite_int64  iDocid,
const char *  zText,
int  iColumn 
) [static]
static int checkColumnSpecifier ( fulltext_vtab pVtab,
const char *  zToken,
int  nToken 
) [static]

Definition at line 3792 of file fts3.c.

References fulltext_vtab::azColumn, and fulltext_vtab::nColumn.

Referenced by tokenizeSegment().

static int clearPendingTerms ( fulltext_vtab v  )  [static]
static void clearTableSpec ( TableSpec p  )  [static]
static int constructVtab ( sqlite3 db,
fts3Hash pHash,
TableSpec spec,
sqlite3_vtab **  ppVTab,
char **  pzErr 
) [static]
static int content_delete ( fulltext_vtab v,
sqlite_int64  iDocid 
) [static]

Definition at line 2252 of file fts3.c.

References CONTENT_DELETE_STMT, sql_get_statement(), sql_single_step(), sqlite3_bind_int64(), and SQLITE_OK.

Referenced by index_delete().

static int content_exists ( fulltext_vtab v  )  [static]
static int content_insert ( fulltext_vtab v,
sqlite3_value docid,
sqlite3_value **  pValues 
) [static]
static int content_select ( fulltext_vtab v,
sqlite_int64  iDocid,
const char ***  pValues 
) [static]
static int content_update ( fulltext_vtab v,
sqlite3_value **  pValues,
sqlite_int64  iDocid 
) [static]
static const char* contentInsertStatement ( fulltext_vtab v  )  [static]
static const char* contentSelectStatement ( fulltext_vtab v  )  [static]
static const char* contentUpdateStatement ( fulltext_vtab v  )  [static]
static struct fulltext_vtab* cursor_vtab ( fulltext_cursor c  )  [static, read]

Definition at line 2032 of file fts3.c.

References fulltext_cursor::base, and sqlite3_vtab_cursor::pVtab.

Referenced by fulltextColumn(), fulltextFilter(), and optimizeFunc().

static void dataBufferAppend ( DataBuffer pBuffer,
const char *  pSource,
int  nSource 
) [static]
static void dataBufferAppend2 ( DataBuffer pBuffer,
const char *  pSource1,
int  nSource1,
const char *  pSource2,
int  nSource2 
) [static]
static void dataBufferDestroy ( DataBuffer pBuffer  )  [static]
static void dataBufferExpand ( DataBuffer pBuffer,
int  nAddCapacity 
) [static]
static void dataBufferInit ( DataBuffer pBuffer,
int  nCapacity 
) [static]
static void dataBufferReplace ( DataBuffer pBuffer,
const char *  pSource,
int  nSource 
) [static]
static void dataBufferReset ( DataBuffer pBuffer  )  [static]
static void dataBufferSwap ( DataBuffer pBuffer1,
DataBuffer pBuffer2 
) [static]

Definition at line 465 of file fts3.c.

Referenced by loadSegmentLeavesInt().

static int deleteTerms ( fulltext_vtab v,
sqlite_int64  iDocid 
) [static]
static void dequoteString ( char *  z  )  [static]

Definition at line 2701 of file fts3.c.

Referenced by firstToken(), and tokenListToIdList().

static void dlcAddDoclist ( DLCollector pCollector,
DataBuffer b 
) [static]
static void dlcAddPos ( DLCollector pCollector,
int  iColumn,
int  iPos,
int  iStartOffset,
int  iEndOffset 
) [static]

Definition at line 1067 of file fts3.c.

References DLCollector::plw, and plwAdd().

Referenced by buildTerms().

static void dlcDelete ( DLCollector pCollector  )  [static]
static DLCollector* dlcNew ( sqlite_int64  iDocid,
DocListType  iType 
) [static]
static void dlcNext ( DLCollector pCollector,
sqlite_int64  iDocid 
) [static]

Definition at line 1062 of file fts3.c.

References DLCollector::dlw, DLCollector::plw, plwDestroy(), plwInit(), and plwTerminate().

Referenced by buildTerms().

static int dlrAllDataBytes ( DLReader pReader  )  [static]

Definition at line 614 of file fts3.c.

References dlrAtEnd(), and DLReader::nData.

Referenced by docListMerge(), and leafWriterStepMerge().

static int dlrAtEnd ( DLReader pReader  )  [static]
static void dlrDestroy ( DLReader pReader  )  [static]
static const char* dlrDocData ( DLReader pReader  )  [static]

Definition at line 606 of file fts3.c.

References dlrAtEnd(), and DLReader::pData.

Referenced by dlwCopy(), and docListMerge().

static int dlrDocDataBytes ( DLReader pReader  )  [static]

Definition at line 610 of file fts3.c.

References dlrAtEnd(), and DLReader::nElement.

Referenced by dlwCopy(), and docListMerge().

static sqlite_int64 dlrDocid ( DLReader pReader  )  [static]
static void dlrInit ( DLReader pReader,
DocListType  iType,
const char *  pData,
int  nData 
) [static]
static const char* dlrPosData ( DLReader pReader  )  [static]

Definition at line 622 of file fts3.c.

References dlrAtEnd(), fts3GetVarint(), and DLReader::pData.

Referenced by plrInit().

static int dlrPosDataLen ( DLReader pReader  )  [static]

Definition at line 628 of file fts3.c.

References dlrAtEnd(), fts3GetVarint(), DLReader::nElement, and DLReader::pData.

Referenced by plrInit().

static void dlrStep ( DLReader pReader  )  [static]
static void dlwAdd ( DLWriter pWriter,
sqlite_int64  iDocid 
) [static]
static void dlwAppend ( DLWriter pWriter,
const char *  pData,
int  nData,
sqlite_int64  iFirstDocid,
sqlite_int64  iLastDocid 
) [static]
static void dlwCopy ( DLWriter pWriter,
DLReader pReader 
) [static]

Definition at line 800 of file fts3.c.

References dlrDocData(), dlrDocDataBytes(), dlrDocid(), and dlwAppend().

Referenced by docListUnion().

static void dlwDestroy ( DLWriter pWriter  )  [static]
static void dlwInit ( DLWriter pWriter,
DocListType  iType,
DataBuffer b 
) [static]
static void docListAccumulateUnion ( DataBuffer acc,
const char *  pData,
int  nData 
) [static]
static void docListAndMerge ( const char *  pLeft,
int  nLeft,
const char *  pRight,
int  nRight,
DataBuffer pOut 
) [static]
static void docListExceptMerge ( const char *  pLeft,
int  nLeft,
const char *  pRight,
int  nRight,
DataBuffer pOut 
) [static]
static void docListMerge ( DataBuffer out,
DLReader pReaders,
int  nReaders 
) [static]
static int docListOfTerm ( fulltext_vtab v,
int  iColumn,
QueryTerm pQTerm,
DataBuffer pResult 
) [static]
static void docListOrMerge ( const char *  pLeft,
int  nLeft,
const char *  pRight,
int  nRight,
DataBuffer pOut 
) [static]
static void docListPhraseMerge ( const char *  pLeft,
int  nLeft,
const char *  pRight,
int  nRight,
int  nNear,
int  nPhrase,
DocListType  iType,
DataBuffer pOut 
) [static]
static void docListTrim ( DocListType  iType,
const char *  pData,
int  nData,
int  iColumn,
DocListType  iOutType,
DataBuffer out 
) [static]
static void docListUnion ( const char *  pLeft,
int  nLeft,
const char *  pRight,
int  nRight,
DataBuffer pOut 
) [static]
static int endsInWhiteSpace ( StringBuffer p  )  [static]

Definition at line 543 of file fts3.c.

References safe_isspace(), stringBufferData(), and stringBufferLength().

Referenced by appendWhiteSpace(), and trimWhiteSpace().

static char* firstToken ( char *  zIn,
char **  pzTail 
) [static]

Definition at line 2765 of file fts3.c.

References dequoteString(), ftsGetToken(), TOKEN_EOF, TOKEN_SPACE, and ttype.

Referenced by parseSpec().

static int flushPendingTerms ( fulltext_vtab v  )  [static]
static void freeStringArray ( int  nString,
const char **  pString 
) [static]

Definition at line 2197 of file fts3.c.

References sqlite3_free().

Referenced by content_select(), and deleteTerms().

static int fts3GetVarint ( const char *  p,
sqlite_int64 v 
) [static]

Definition at line 408 of file fts3.c.

References VARINT_MAX.

Referenced by dlrPosData(), dlrPosDataLen(), dlrStep(), dlwAppend(), fts3GetVarint32(), and interiorReaderInit().

static int fts3GetVarint32 ( const char *  p,
int *  pi 
) [static]
static int fts3PutVarint ( char *  p,
sqlite_int64  v 
) [static]
static int ftsGetToken ( const char *  z,
int *  tokenType 
) [static]

Definition at line 2586 of file fts3.c.

References ftsIdChar, safe_isspace(), TOKEN_EOF, TOKEN_ID, TOKEN_PUNCT, TOKEN_SPACE, and TOKEN_STRING.

Referenced by firstToken(), and tokenizeString().

static void fulltext_vtab_destroy ( fulltext_vtab v  )  [static]
static int fulltextBegin ( sqlite3_vtab pVtab  )  [static]

Definition at line 6287 of file fts3.c.

References clearPendingTerms(), FTSTRACE, and fulltext_vtab::nPendingData.

static int fulltextBestIndex ( sqlite3_vtab pVTab,
sqlite3_index_info pInfo 
) [static]
static int fulltextClose ( sqlite3_vtab_cursor pCursor  )  [static]
static int fulltextColumn ( sqlite3_vtab_cursor pCursor,
sqlite3_context pContext,
int  idxCol 
) [static]
static int fulltextCommit ( sqlite3_vtab pVtab  )  [static]

Definition at line 6298 of file fts3.c.

References clearPendingTerms(), FTSTRACE, and fulltext_vtab::nPendingData.

static int fulltextConnect ( sqlite3 db,
void *  pAux,
int  argc,
const char *const *  argv,
sqlite3_vtab **  ppVTab,
char **  pzErr 
) [static]

Definition at line 3038 of file fts3.c.

References clearTableSpec(), constructVtab(), parseSpec(), and SQLITE_OK.

static int fulltextCreate ( sqlite3 db,
void *  pAux,
int  argc,
const char *const *  argv,
sqlite3_vtab **  ppVTab,
char **  pzErr 
) [static]
static int fulltextDestroy ( sqlite3_vtab pVTab  )  [static]
static int fulltextDisconnect ( sqlite3_vtab pVTab  )  [static]

Definition at line 3143 of file fts3.c.

References FTSTRACE, fulltext_vtab_destroy(), and SQLITE_OK.

static int fulltextEof ( sqlite3_vtab_cursor pCursor  )  [static]

Definition at line 4176 of file fts3.c.

References fulltext_cursor::eof.

static int fulltextFilter ( sqlite3_vtab_cursor pCursor,
int  idxNum,
const char *  idxStr,
int  argc,
sqlite3_value **  argv 
) [static]
static int fulltextFindFunction ( sqlite3_vtab pVtab,
int  nArg,
const char *  zName,
void(**)(sqlite3_context *, int, sqlite3_value **)  pxFunc,
void **  ppArg 
) [static]

Definition at line 7032 of file fts3.c.

References optimizeFunc(), snippetFunc(), and snippetOffsetsFunc().

static int fulltextNext ( sqlite3_vtab_cursor pCursor  )  [static]
static int fulltextOpen ( sqlite3_vtab pVTab,
sqlite3_vtab_cursor **  ppCursor 
) [static]

Definition at line 3165 of file fts3.c.

References fulltext_cursor::base, FTSTRACE, sqlite3_malloc(), SQLITE_NOMEM, and SQLITE_OK.

static int fulltextQuery ( fulltext_vtab v,
int  iColumn,
const char *  zInput,
int  nInput,
DataBuffer pResult,
Query pQuery 
) [static]
static int fulltextRename ( sqlite3_vtab pVtab,
const char *  zName 
) [static]
static int fulltextRollback ( sqlite3_vtab pVtab  )  [static]

Definition at line 6307 of file fts3.c.

References clearPendingTerms(), and FTSTRACE.

static int fulltextRowid ( sqlite3_vtab_cursor pCursor,
sqlite_int64 pRowid 
) [static]

Definition at line 4213 of file fts3.c.

References fulltext_cursor::pStmt, sqlite3_column_int64(), and SQLITE_OK.

static char* fulltextSchema ( int  nColumn,
const char *const *  azColumn,
const char *  zTableName 
) [static]

Definition at line 2932 of file fts3.c.

References sqlite3_free(), and sqlite3_mprintf().

Referenced by constructVtab().

static int fulltextSync ( sqlite3_vtab pVtab  )  [static]

Definition at line 6282 of file fts3.c.

References flushPendingTerms(), and FTSTRACE.

static int fulltextUpdate ( sqlite3_vtab pVtab,
int  nArg,
sqlite3_value **  ppArg,
sqlite_int64 pRowid 
) [static]
static void getChildrenContaining ( const char *  pData,
int  nData,
const char *  pTerm,
int  nTerm,
int  isPrefix,
sqlite_int64 piStartChild,
sqlite_int64 piEndChild 
) [static]
static void hashDestroy ( void *  p  )  [static]

Definition at line 7113 of file fts3.c.

References sqlite3_free(), and sqlite3Fts3HashClear().

Referenced by sqlite3Fts3Init().

static int index_delete ( fulltext_vtab v,
sqlite_int64  iRow 
) [static]

Definition at line 4339 of file fts3.c.

References content_delete(), deleteTerms(), initPendingTerms(), and SQLITE_OK.

Referenced by fulltextUpdate().

static int index_insert ( fulltext_vtab v,
sqlite3_value pRequestDocid,
sqlite3_value **  pValues,
sqlite_int64 piDocid 
) [static]
static int index_update ( fulltext_vtab v,
sqlite_int64  iRow,
sqlite3_value **  pValues 
) [static]

Definition at line 4353 of file fts3.c.

References content_update(), deleteTerms(), initPendingTerms(), insertTerms(), and SQLITE_OK.

Referenced by fulltextUpdate().

static int initPendingTerms ( fulltext_vtab v,
sqlite_int64  iDocid 
) [static]
static void initStringBuffer ( StringBuffer sb  )  [static]
static int insertTerms ( fulltext_vtab v,
sqlite_int64  iDocid,
sqlite3_value **  pValues 
) [static]

Definition at line 4282 of file fts3.c.

References buildTerms(), fulltext_vtab::nColumn, sqlite3_value_text(), and SQLITE_OK.

Referenced by index_insert(), and index_update().

static InteriorBlock* interiorBlockNew ( int  iHeight,
sqlite_int64  iChildBlock,
const char *  pTerm,
int  nTerm 
) [static]
static int interiorReaderAtEnd ( InteriorReader pReader  )  [static]
static sqlite_int64 interiorReaderCurrentBlockid ( InteriorReader pReader  )  [static]

Definition at line 4709 of file fts3.c.

References InteriorReader::iBlockid.

Referenced by getChildrenContaining().

static void interiorReaderDestroy ( InteriorReader pReader  )  [static]

Definition at line 4665 of file fts3.c.

References dataBufferDestroy(), SCRAMBLE, and InteriorReader::term.

Referenced by getChildrenContaining().

static void interiorReaderInit ( const char *  pData,
int  nData,
InteriorReader pReader 
) [static]
static void interiorReaderStep ( InteriorReader pReader  )  [static]
static const char* interiorReaderTerm ( InteriorReader pReader  )  [static]

Definition at line 4717 of file fts3.c.

References interiorReaderAtEnd(), DataBuffer::pData, and InteriorReader::term.

Referenced by interiorReaderTermCmp().

static int interiorReaderTermBytes ( InteriorReader pReader  )  [static]

Definition at line 4713 of file fts3.c.

References interiorReaderAtEnd(), DataBuffer::nData, and InteriorReader::term.

Referenced by interiorReaderTermCmp().

static int interiorReaderTermCmp ( InteriorReader pReader,
const char *  pTerm,
int  nTerm,
int  isPrefix 
) [static]

Definition at line 4751 of file fts3.c.

References interiorReaderTerm(), and interiorReaderTermBytes().

Referenced by getChildrenContaining().

static void interiorWriterAppend ( InteriorWriter pWriter,
const char *  pTerm,
int  nTerm,
sqlite_int64  iChildBlock 
) [static]
static int interiorWriterDestroy ( InteriorWriter pWriter  )  [static]
static void interiorWriterInit ( int  iHeight,
const char *  pTerm,
int  nTerm,
sqlite_int64  iChildBlock,
InteriorWriter pWriter 
) [static]
static int interiorWriterRootInfo ( fulltext_vtab v,
InteriorWriter pWriter,
char **  ppRootInfo,
int *  pnRootInfo,
sqlite_int64 piEndBlockid 
) [static]
static int leafReaderAtEnd ( LeafReader pReader  )  [static]

Definition at line 5249 of file fts3.c.

References LeafReader::nData.

Referenced by leafReaderStep(), and leavesReaderStep().

static const char* leafReaderData ( LeafReader pReader  )  [static]

Definition at line 5269 of file fts3.c.

References fts3GetVarint32(), DataBuffer::nData, LeafReader::pData, and LeafReader::term.

Referenced by leavesReaderData().

static int leafReaderDataBytes ( LeafReader pReader  )  [static]

Definition at line 5263 of file fts3.c.

References fts3GetVarint32(), DataBuffer::nData, LeafReader::pData, and LeafReader::term.

Referenced by leavesReaderDataBytes().

static void leafReaderDestroy ( LeafReader pReader  )  [static]

Definition at line 5244 of file fts3.c.

References dataBufferDestroy(), SCRAMBLE, and LeafReader::term.

Referenced by leavesReaderDestroy(), and leavesReaderStep().

static void leafReaderInit ( const char *  pData,
int  nData,
LeafReader pReader 
) [static]
static void leafReaderStep ( LeafReader pReader  )  [static]
static const char* leafReaderTerm ( LeafReader pReader  )  [static]

Definition at line 5257 of file fts3.c.

References DataBuffer::nData, DataBuffer::pData, and LeafReader::term.

Referenced by leavesReaderTerm().

static int leafReaderTermBytes ( LeafReader pReader  )  [static]

Definition at line 5254 of file fts3.c.

References DataBuffer::nData, and LeafReader::term.

Referenced by leavesReaderTermBytes().

static int leafReaderTermCmp ( LeafReader pReader,
const char *  pTerm,
int  nTerm,
int  isPrefix 
) [static]

Definition at line 5325 of file fts3.c.

References DataBuffer::nData, DataBuffer::pData, and LeafReader::term.

Referenced by leavesReaderTermCmp(), and loadSegmentLeavesInt().

static void leafWriterDestroy ( LeafWriter pWriter  )  [static]
static int leafWriterEncodeTerm ( LeafWriter pWriter,
const char *  pTerm,
int  nTerm 
) [static]
static int leafWriterFinalize ( fulltext_vtab v,
LeafWriter pWriter 
) [static]
static int leafWriterFlush ( fulltext_vtab v,
LeafWriter pWriter 
) [static]
static void leafWriterInit ( int  iLevel,
int  idx,
LeafWriter pWriter 
) [static]
static int leafWriterInlineFlush ( fulltext_vtab v,
LeafWriter pWriter,
const char *  pTerm,
int  nTerm,
int  iDoclistData 
) [static]
static int leafWriterInternalFlush ( fulltext_vtab v,
LeafWriter pWriter,
int  iData,
int  nData 
) [static]
static int leafWriterRootInfo ( fulltext_vtab v,
LeafWriter pWriter,
char **  ppRootInfo,
int *  pnRootInfo,
sqlite_int64 piEndBlockid 
) [static]
static int leafWriterStep ( fulltext_vtab v,
LeafWriter pWriter,
const char *  pTerm,
int  nTerm,
const char *  pData,
int  nData 
) [static]

Definition at line 5221 of file fts3.c.

References DL_DEFAULT, dlrDestroy(), dlrInit(), and leafWriterStepMerge().

Referenced by optimizeInternal(), and writeZeroSegment().

static int leafWriterStepMerge ( fulltext_vtab v,
LeafWriter pWriter,
const char *  pTerm,
int  nTerm,
DLReader pReaders,
int  nReaders 
) [static]
static int leavesReaderAtEnd ( LeavesReader pReader  )  [static]
static int leavesReaderCmp ( LeavesReader lr1,
LeavesReader lr2 
) [static]

Definition at line 5497 of file fts3.c.

References LeavesReader::idx, and leavesReaderTermCmp().

Referenced by leavesReaderReorder().

static const char* leavesReaderData ( LeavesReader pReader  )  [static]
static int leavesReaderDataBytes ( LeavesReader pReader  )  [static]
static void leavesReaderDestroy ( LeavesReader pReader  )  [static]
static int leavesReaderInit ( fulltext_vtab v,
int  idx,
sqlite_int64  iStartBlockid,
sqlite_int64  iEndBlockid,
const char *  pRootData,
int  nRootData,
LeavesReader pReader 
) [static]
static void leavesReaderReorder ( LeavesReader pLr,
int  nLr 
) [static]

Definition at line 5506 of file fts3.c.

References leavesReaderCmp().

Referenced by leavesReadersInit(), and segmentMerge().

static int leavesReaderReset ( LeavesReader pReader  )  [static]

Definition at line 5392 of file fts3.c.

References LeavesReader::pStmt, and sqlite3_reset().

Referenced by loadSegmentLeaf(), and loadSegmentLeaves().

static int leavesReadersInit ( fulltext_vtab v,
int  iLevel,
LeavesReader pReaders,
int *  piReaders 
) [static]
static int leavesReadersMerge ( fulltext_vtab v,
LeavesReader pReaders,
int  nReaders,
LeafWriter pWriter 
) [static]
static int leavesReaderStep ( fulltext_vtab v,
LeavesReader pReader 
) [static]
static const char* leavesReaderTerm ( LeavesReader pReader  )  [static]
static int leavesReaderTermBytes ( LeavesReader pReader  )  [static]
static int leavesReaderTermCmp ( LeavesReader lr1,
LeavesReader lr2 
) [static]
static int loadAndGetChildrenContaining ( fulltext_vtab v,
sqlite_int64  iBlockid,
const char *  pTerm,
int  nTerm,
int  isPrefix,
sqlite_int64 piStartChild,
sqlite_int64 piEndChild 
) [static]
static int loadSegment ( fulltext_vtab v,
const char *  pData,
int  nData,
sqlite_int64  iLeavesEnd,
const char *  pTerm,
int  nTerm,
int  isPrefix,
DataBuffer out 
) [static]
static int loadSegmentInt ( fulltext_vtab v,
const char *  pData,
int  nData,
sqlite_int64  iLeavesEnd,
const char *  pTerm,
int  nTerm,
int  isPrefix,
DataBuffer out 
) [static]
static int loadSegmentLeaf ( fulltext_vtab v,
const char *  pData,
int  nData,
const char *  pTerm,
int  nTerm,
int  isPrefix,
DataBuffer out 
) [static]
static int loadSegmentLeaves ( fulltext_vtab v,
sqlite_int64  iStartLeaf,
sqlite_int64  iEndLeaf,
const char *  pTerm,
int  nTerm,
int  isPrefix,
DataBuffer out 
) [static]
static int loadSegmentLeavesInt ( fulltext_vtab v,
LeavesReader pReader,
const char *  pTerm,
int  nTerm,
int  isPrefix,
DataBuffer out 
) [static]
static void nappend ( StringBuffer sb,
const char *  zFrom,
int  nFrom 
) [static]

Definition at line 523 of file fts3.c.

References StringBuffer::b, dataBufferAppend2(), and DataBuffer::nData.

Referenced by append(), and snippetText().

static void optimizeFunc ( sqlite3_context pContext,
int  argc,
sqlite3_value **  argv 
) [static]
static int optimizeInternal ( fulltext_vtab v,
OptLeavesReader readers,
int  nReaders,
LeafWriter pWriter 
) [static]
static int optLeavesReaderAtEnd ( OptLeavesReader pReader  )  [static]

Definition at line 6393 of file fts3.c.

References leavesReaderAtEnd(), and OptLeavesReader::reader.

Referenced by optimizeInternal().

static int optLeavesReaderCmp ( OptLeavesReader lr1,
OptLeavesReader lr2 
) [static]

Definition at line 6417 of file fts3.c.

References optLeavesReaderTermCmp(), and OptLeavesReader::segment.

Referenced by optLeavesReaderReorder().

static const char* optLeavesReaderData ( OptLeavesReader pReader  )  [static]

Definition at line 6399 of file fts3.c.

References leavesReaderData(), and OptLeavesReader::reader.

Referenced by optimizeInternal().

static int optLeavesReaderDataBytes ( OptLeavesReader pReader  )  [static]

Definition at line 6402 of file fts3.c.

References leavesReaderDataBytes(), and OptLeavesReader::reader.

Referenced by optimizeInternal().

static void optLeavesReaderReorder ( OptLeavesReader pLr,
int  nLr 
) [static]

Definition at line 6425 of file fts3.c.

References optLeavesReaderCmp().

Referenced by optimizeInternal().

static int optLeavesReaderStep ( fulltext_vtab v,
OptLeavesReader pReader 
) [static]

Definition at line 6408 of file fts3.c.

References leavesReaderStep(), and OptLeavesReader::reader.

Referenced by optimizeInternal().

static const char* optLeavesReaderTerm ( OptLeavesReader pReader  )  [static]

Definition at line 6405 of file fts3.c.

References leavesReaderTerm(), and OptLeavesReader::reader.

Referenced by optimizeInternal().

static int optLeavesReaderTermBytes ( OptLeavesReader pReader  )  [static]

Definition at line 6396 of file fts3.c.

References leavesReaderTermBytes(), and OptLeavesReader::reader.

Referenced by optimizeInternal().

static int optLeavesReaderTermCmp ( OptLeavesReader lr1,
OptLeavesReader lr2 
) [static]

Definition at line 6411 of file fts3.c.

References leavesReaderTermCmp(), and OptLeavesReader::reader.

Referenced by optimizeInternal(), and optLeavesReaderCmp().

static int orderedDLReaderCmp ( OrderedDLReader r1,
OrderedDLReader r2 
) [static]

Definition at line 1152 of file fts3.c.

References dlrAtEnd(), dlrDocid(), OrderedDLReader::idx, and OrderedDLReader::pReader.

Referenced by orderedDLReaderReorder().

static void orderedDLReaderReorder ( OrderedDLReader p,
int  n 
) [static]

Definition at line 1174 of file fts3.c.

References orderedDLReaderCmp().

Referenced by docListMerge().

static int parseQuery ( fulltext_vtab v,
const char *  zInput,
int  nInput,
int  dfltColumn,
Query pQuery 
) [static]
static int parseSpec ( TableSpec pSpec,
int  argc,
const char *const *  argv,
char **  pzErr 
) [static]
static int plrAtEnd ( PLReader pReader  )  [static]
static int plrColumn ( PLReader pReader  )  [static]

Definition at line 847 of file fts3.c.

References PLReader::iColumn, and plrAtEnd().

Referenced by docListTrim(), plrCompare(), plwCopy(), posListCmp(), and posListPhraseMerge().

static int plrCompare ( PLReader pLeft,
PLReader pRight 
) [static]

Definition at line 1465 of file fts3.c.

References plrAtEnd(), plrColumn(), and plrPosition().

Referenced by docListPhraseMerge().

static void plrDestroy ( PLReader pReader  )  [static]

Definition at line 911 of file fts3.c.

References SCRAMBLE.

Referenced by docListTrim(), posListPhraseMerge(), and posListUnion().

static int plrEndOffset ( PLReader pReader  )  [static]

Definition at line 859 of file fts3.c.

References PLReader::iEndOffset, and plrAtEnd().

Referenced by docListTrim(), plwCopy(), and posListCmp().

static void plrInit ( PLReader pReader,
DLReader pDLReader 
) [static]
static int plrPosition ( PLReader pReader  )  [static]

Definition at line 851 of file fts3.c.

References PLReader::iPosition, and plrAtEnd().

Referenced by docListTrim(), plrCompare(), plwCopy(), posListCmp(), and posListPhraseMerge().

static int plrStartOffset ( PLReader pReader  )  [static]

Definition at line 855 of file fts3.c.

References PLReader::iStartOffset, and plrAtEnd().

Referenced by docListTrim(), plwCopy(), and posListCmp().

static void plrStep ( PLReader pReader  )  [static]
static void plwAdd ( PLWriter pWriter,
int  iColumn,
int  iPos,
int  iStartOffset,
int  iEndOffset 
) [static]
static void plwCopy ( PLWriter pWriter,
PLReader pReader 
) [static]

Definition at line 983 of file fts3.c.

References plrColumn(), plrEndOffset(), plrPosition(), plrStartOffset(), and plwAdd().

Referenced by docListPhraseMerge(), and posListUnion().

static void plwDestroy ( PLWriter pWriter  )  [static]

Definition at line 1025 of file fts3.c.

References SCRAMBLE.

Referenced by dlcDelete(), dlcNext(), docListTrim(), posListPhraseMerge(), and posListUnion().

static void plwInit ( PLWriter pWriter,
DLWriter dlw,
sqlite_int64  iDocid 
) [static]
static void plwTerminate ( PLWriter pWriter  )  [static]
static int posListCmp ( PLReader pLeft,
PLReader pRight 
) [static]
static void posListPhraseMerge ( DLReader pLeft,
DLReader pRight,
int  nNear,
int  isSaveLeft,
DLWriter pOut 
) [static]
static void posListUnion ( DLReader pLeft,
DLReader pRight,
DLWriter pOut 
) [static]
static void queryAdd ( Query q,
const char *  pTerm,
int  nTerm 
) [static]
static void queryClear ( Query q  )  [static]
static int safe_isalnum ( char  c  )  [static]

Definition at line 335 of file fts3.c.

Referenced by parseSpec(), startsWith(), and tokenListToIdList().

static int safe_isspace ( char  c  )  [static]

Definition at line 329 of file fts3.c.

Referenced by endsInWhiteSpace(), ftsGetToken(), startsWith(), and wordBoundary().

static int safe_tolower ( char  c  )  [static]

Definition at line 332 of file fts3.c.

Referenced by startsWith().

static int segdir_count ( fulltext_vtab v,
int *  pnSegments,
int *  piMaxLevel 
) [static]
static int segdir_delete ( fulltext_vtab v,
int  iLevel 
) [static]
static int segdir_delete_all ( fulltext_vtab v  )  [static]
static int segdir_max_index ( fulltext_vtab v,
int  iLevel,
int *  pidx 
) [static]
static int segdir_set ( fulltext_vtab v,
int  iLevel,
int  idx,
sqlite_int64  iStartBlockid,
sqlite_int64  iLeavesEndBlockid,
sqlite_int64  iEndBlockid,
const char *  pRootData,
int  nRootData 
) [static]
static int segdir_span ( fulltext_vtab v,
int  iLevel,
sqlite_int64 piStartBlockid,
sqlite_int64 piEndBlockid 
) [static]
static int segdirNextIndex ( fulltext_vtab v,
int  iLevel,
int *  pidx 
) [static]

Definition at line 5589 of file fts3.c.

References MERGE_COUNT, segdir_max_index(), segmentMerge(), SQLITE_DONE, SQLITE_OK, and SQLITE_ROW.

Referenced by segmentMerge(), and writeZeroSegment().

static int segmentMerge ( fulltext_vtab v,
int  iLevel 
) [static]
static void snippetAllOffsets ( fulltext_cursor p  )  [static]
static void snippetAppendMatch ( Snippet p,
int  iCol,
int  iTerm,
int  iToken,
int  iStart,
int  nByte 
) [static]

Definition at line 3204 of file fts3.c.

References Snippet::aMatch, Snippet::nAlloc, Snippet::nMatch, and sqlite3_realloc().

Referenced by snippetOffsetsOfColumn().

static void snippetClear ( Snippet p  )  [static]

Definition at line 3195 of file fts3.c.

References Snippet::aMatch, CLEAR, sqlite3_free(), Snippet::zOffset, and Snippet::zSnippet.

Referenced by fulltextClose(), and fulltextNext().

static void snippetFunc ( sqlite3_context pContext,
int  argc,
sqlite3_value **  argv 
) [static]
static void snippetOffsetsFunc ( sqlite3_context pContext,
int  argc,
sqlite3_value **  argv 
) [static]
static void snippetOffsetsOfColumn ( Query pQuery,
Snippet pSnippet,
int  iColumn,
const char *  zDoc,
int  nDoc 
) [static]
static void snippetOffsetText ( Snippet p  )  [static]
static void snippetText ( fulltext_cursor pCursor,
const char *  zStartMark,
const char *  zEndMark,
const char *  zEllipsis 
) [static]
static int sql_exec ( sqlite3 db,
const char *  zDb,
const char *  zName,
const char *  zFormat 
) [static]

Definition at line 1766 of file fts3.c.

References FTSTRACE, sqlite3_exec(), sqlite3_free(), and string_format().

Referenced by fulltextCreate(), and fulltextDestroy().

static int sql_get_leaf_statement ( fulltext_vtab v,
int  idx,
sqlite3_stmt **  ppStmt 
) [static]
static int sql_get_statement ( fulltext_vtab v,
fulltext_statement  iStmt,
sqlite3_stmt **  ppStmt 
) [static]
static int sql_prepare ( sqlite3 db,
const char *  zDb,
const char *  zName,
sqlite3_stmt **  ppStmt,
const char *  zFormat 
) [static]
static int sql_single_step ( sqlite3_stmt s  )  [static]
int sqlite3_extension_init ( sqlite3 db,
char **  pzErrMsg,
const sqlite3_api_routines pApi 
)

Definition at line 7202 of file fts3.c.

References sqlite3Fts3Init(), and SQLITE_EXTENSION_INIT2.

void sqlite3Fts3IcuTokenizerModule ( sqlite3_tokenizer_module const **  ppModule  ) 

Referenced by sqlite3Fts3Init().

int sqlite3Fts3Init ( sqlite3 db  ) 
int sqlite3Fts3InitHashTable ( sqlite3 ,
fts3Hash ,
const char *   
)
void sqlite3Fts3PorterTokenizerModule ( sqlite3_tokenizer_module const **  ppModule  ) 

Definition at line 636 of file fts3_porter.c.

Referenced by sqlite3Fts3Init().

void sqlite3Fts3SimpleTokenizerModule ( sqlite3_tokenizer_module const **  ppModule  ) 

Definition at line 224 of file fts3_tokenizer1.c.

Referenced by sqlite3Fts3Init().

static int startsWith ( const char *  s,
const char *  t 
) [static]

Definition at line 2795 of file fts3.c.

References safe_isalnum(), safe_isspace(), and safe_tolower().

Referenced by parseSpec().

static char* string_dup ( const char *  s  )  [static]

Definition at line 1725 of file fts3.c.

References string_dup_n().

Referenced by content_select().

static char* string_dup_n ( const char *  s,
int  n 
) [static]

Definition at line 1715 of file fts3.c.

References sqlite3_malloc().

Referenced by string_dup().

static char* string_format ( const char *  zFormat,
const char *  zDb,
const char *  zName 
) [static]

Definition at line 1733 of file fts3.c.

References sqlite3_malloc().

Referenced by sql_exec(), and sql_prepare().

static char* stringBufferData ( StringBuffer sb  )  [static]
static void stringBufferDestroy ( StringBuffer sb  )  [static]

Definition at line 519 of file fts3.c.

References StringBuffer::b, and dataBufferDestroy().

Referenced by fulltextCreate(), and fulltextFilter().

static int stringBufferLength ( StringBuffer sb  )  [static]

Definition at line 513 of file fts3.c.

References StringBuffer::b, and DataBuffer::nData.

Referenced by appendWhiteSpace(), endsInWhiteSpace(), snippetOffsetText(), and snippetText().

static int termDataCmp ( const void *  av,
const void *  bv 
) [static]

Definition at line 6098 of file fts3.c.

References TermData::nTerm, and TermData::pTerm.

Referenced by writeZeroSegment().

static int termSelect ( fulltext_vtab v,
int  iColumn,
const char *  pTerm,
int  nTerm,
int  isPrefix,
DocListType  iType,
DataBuffer out 
) [static]
static int tokenizeSegment ( sqlite3_tokenizer pTokenizer,
const char *  zSegment,
int  nSegment,
int  inPhrase,
Query pQuery 
) [static]
static char** tokenizeString ( const char *  z,
int *  pnToken 
) [static]

Definition at line 2654 of file fts3.c.

References ftsGetToken(), FtsToken::n, sqlite3_free(), sqlite3_malloc(), TOKEN_SPACE, and FtsToken::z.

Referenced by parseSpec().

static void tokenListToIdList ( char **  azIn  )  [static]

Definition at line 2743 of file fts3.c.

References dequoteString(), and safe_isalnum().

Referenced by parseSpec().

static void trimSnippetOffsetsForNear ( Query pQuery,
Snippet pSnippet 
) [static]
static void trimWhiteSpace ( StringBuffer p  )  [static]

Definition at line 557 of file fts3.c.

References StringBuffer::b, endsInWhiteSpace(), DataBuffer::nData, and DataBuffer::pData.

Referenced by snippetText().

static int wordBoundary ( int  iBreak,
const char *  zDoc,
int  nDoc,
struct snippetMatch *  aMatch,
int  nMatch,
int  iCol 
) [static]

Definition at line 3481 of file fts3.c.

References safe_isspace().

Referenced by snippetText().

static int writeZeroSegment ( fulltext_vtab v,
fts3Hash pTerms 
) [static]

Variable Documentation

static const sqlite3_module fts3Module [static]
const char* const fulltext_zStatement[MAX_STMT] [static]

Definition at line 1933 of file fts3.c.

const char isFtsIdChar[] [static]
Initial value:
 {

    0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  
}

Definition at line 2570 of file fts3.c.


ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:59 2011 by Doxygen 1.6.1