mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Defer building xInstToken() hash-table until it is to be used.
FossilOrigin-Name: 9b005085ff4a53cda0a1dff0c836630d6d3b95b9c40658ffd2a886f3e1b37faa
This commit is contained in:
@ -550,7 +550,6 @@ void sqlite3Fts5IndexIterClearTokendata(Fts5IndexIter*);
|
||||
int sqlite3Fts5IndexIterWriteTokendata(
|
||||
Fts5IndexIter*, const char*, int, int iCol, int iOff
|
||||
);
|
||||
int sqlite3Fts5IndexIterHashifyTokendata(Fts5IndexIter*);
|
||||
|
||||
/*
|
||||
** End of interface to code in fts5_index.c.
|
||||
|
@ -3044,7 +3044,6 @@ int sqlite3Fts5ExprPopulatePoslists(
|
||||
const char *z, int n
|
||||
){
|
||||
int i;
|
||||
int rc = SQLITE_OK;
|
||||
Fts5ExprCtx sCtx;
|
||||
sCtx.pExpr = pExpr;
|
||||
sCtx.aPopulator = aPopulator;
|
||||
@ -3073,20 +3072,9 @@ int sqlite3Fts5ExprPopulatePoslists(
|
||||
}
|
||||
}
|
||||
|
||||
rc = sqlite3Fts5Tokenize(pConfig,
|
||||
return sqlite3Fts5Tokenize(pConfig,
|
||||
FTS5_TOKENIZE_DOCUMENT, z, n, (void*)&sCtx, fts5ExprPopulatePoslistsCb
|
||||
);
|
||||
|
||||
if( pConfig->bTokendata ){
|
||||
for(i=0; i<pExpr->nPhrase; i++){
|
||||
Fts5ExprTerm *pT;
|
||||
for(pT=&pExpr->apExprPhrase[i]->aTerm[0]; pT; pT=pT->pSynonym){
|
||||
sqlite3Fts5IndexIterHashifyTokendata(pT->pIter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void fts5ExprClearPoslists(Fts5ExprNode *pNode){
|
||||
|
@ -628,6 +628,8 @@ struct Fts5TokenMapToken {
|
||||
};
|
||||
|
||||
struct Fts5TokenMap {
|
||||
int bHashed; /* True once hashed */
|
||||
|
||||
int nEntryAlloc;
|
||||
int nEntry;
|
||||
Fts5TokenMapEntry *aEntry;
|
||||
@ -6372,7 +6374,6 @@ static void fts5SetupPrefixIter(
|
||||
** index contains all the doclists required, except for the one
|
||||
** corresponding to the prefix itself. That one is extracted from the
|
||||
** main term index here. */
|
||||
assert( iIdx==0 || pMap==0 );
|
||||
if( iIdx!=0 ){
|
||||
int dummy = 0;
|
||||
const int f2 = FTS5INDEX_QUERY_SKIPEMPTY|FTS5INDEX_QUERY_NOOUTPUT;
|
||||
@ -6402,7 +6403,7 @@ static void fts5SetupPrefixIter(
|
||||
*ppIter = p1;
|
||||
}else{
|
||||
|
||||
if( iIdx==0 && p->pConfig->eDetail==FTS5_DETAIL_FULL ){
|
||||
if( iIdx==0 && p->pConfig->eDetail==FTS5_DETAIL_FULL && bTokenscan ){
|
||||
pMap = (Fts5TokenMap*)fts5IdxMalloc(p, sizeof(Fts5TokenMap));
|
||||
}
|
||||
assert( p->rc!=SQLITE_OK || (aBuf && pStruct) );
|
||||
@ -6473,7 +6474,6 @@ static void fts5SetupPrefixIter(
|
||||
pData->p = (u8*)&pData[1];
|
||||
pData->nn = pData->szLeaf = doclist.n;
|
||||
if( doclist.n ) memcpy(pData->p, doclist.p, doclist.n);
|
||||
if( pMap ) fts5TokenMapHashify(p, pMap);
|
||||
fts5MultiIterNew2(p, pData, pMap, bDesc, ppIter);
|
||||
pMap = 0;
|
||||
}
|
||||
@ -6867,7 +6867,15 @@ int sqlite3Fts5IterToken(
|
||||
const char **ppOut, int *pnOut
|
||||
){
|
||||
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
|
||||
if( pIter->pTokenMap ){
|
||||
Fts5TokenMap *pMap = pIter->pTokenMap;
|
||||
if( pMap ){
|
||||
if( pMap->bHashed==0 ){
|
||||
Fts5Index *p = pIter->pIndex;
|
||||
fts5TokenMapHashify(p, pMap);
|
||||
if( p->rc ){
|
||||
return fts5IndexReturn(p);
|
||||
}
|
||||
}
|
||||
*ppOut = (const char*)fts5TokenMapLookup(
|
||||
pIter->pTokenMap, pIndexIter->iRowid, iCol, iOff, pnOut
|
||||
);
|
||||
@ -6936,14 +6944,6 @@ int sqlite3Fts5IndexIterWriteTokendata(
|
||||
return fts5IndexReturn(p);
|
||||
}
|
||||
|
||||
int sqlite3Fts5IndexIterHashifyTokendata(Fts5IndexIter *pIndexIter){
|
||||
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
|
||||
if( pIter->pTokenMap ){
|
||||
fts5TokenMapHashify(pIter->pIndex, pIter->pTokenMap);
|
||||
}
|
||||
return fts5IndexReturn(pIter->pIndex);
|
||||
}
|
||||
|
||||
/*
|
||||
** Close an iterator opened by an earlier call to sqlite3Fts5IndexQuery().
|
||||
*/
|
||||
|
Reference in New Issue
Block a user