mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Remove some unused code from fts3. Add tests to fts3matchinfo.test.
FossilOrigin-Name: ae40b34cf7c24c9601bdfb5cbe5b20f05a376ea8
This commit is contained in:
@ -2488,75 +2488,6 @@ static void fts3DecodeIntArray(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Fill in the document size auxiliary information for the matchinfo
|
||||
** structure. The auxiliary information is:
|
||||
**
|
||||
** N Total number of documents in the full-text index
|
||||
** a0 Average length of column 0 over the whole index
|
||||
** n0 Length of column 0 on the matching row
|
||||
** ...
|
||||
** aM Average length of column M over the whole index
|
||||
** nM Length of column M on the matching row
|
||||
**
|
||||
** The fts3MatchinfoDocsizeLocal() routine fills in the nX values.
|
||||
** The fts3MatchinfoDocsizeGlobal() routine fills in N and the aX values.
|
||||
*/
|
||||
int sqlite3Fts3MatchinfoDocsizeLocal(Fts3Cursor *pCur, u32 *a){
|
||||
const char *pBlob; /* The BLOB holding %_docsize info */
|
||||
int nBlob; /* Size of the BLOB */
|
||||
sqlite3_stmt *pStmt; /* Statement for reading and writing */
|
||||
int i, j; /* Loop counters */
|
||||
sqlite3_int64 x; /* Varint value */
|
||||
int rc; /* Result code from subfunctions */
|
||||
Fts3Table *p; /* The FTS table */
|
||||
|
||||
p = (Fts3Table*)pCur->base.pVtab;
|
||||
rc = fts3SqlStmt(p, SQL_SELECT_DOCSIZE, &pStmt, 0);
|
||||
if( rc ){
|
||||
return rc;
|
||||
}
|
||||
sqlite3_bind_int64(pStmt, 1, pCur->iPrevId);
|
||||
if( sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
nBlob = sqlite3_column_bytes(pStmt, 0);
|
||||
pBlob = (const char*)sqlite3_column_blob(pStmt, 0);
|
||||
for(i=j=0; i<p->nColumn && j<nBlob; i++){
|
||||
j = sqlite3Fts3GetVarint(&pBlob[j], &x);
|
||||
a[2+i*2] = (u32)(x & 0xffffffff);
|
||||
}
|
||||
}
|
||||
sqlite3_reset(pStmt);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
int sqlite3Fts3MatchinfoDocsizeGlobal(Fts3Cursor *pCur, u32 *a){
|
||||
const char *pBlob; /* The BLOB holding %_stat info */
|
||||
int nBlob; /* Size of the BLOB */
|
||||
sqlite3_stmt *pStmt; /* Statement for reading and writing */
|
||||
int i, j; /* Loop counters */
|
||||
sqlite3_int64 x; /* Varint value */
|
||||
int nDoc; /* Number of documents */
|
||||
int rc; /* Result code from subfunctions */
|
||||
Fts3Table *p; /* The FTS table */
|
||||
|
||||
p = (Fts3Table*)pCur->base.pVtab;
|
||||
rc = fts3SqlStmt(p, SQL_SELECT_DOCTOTAL, &pStmt, 0);
|
||||
if( rc ){
|
||||
return rc;
|
||||
}
|
||||
if( sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
nBlob = sqlite3_column_bytes(pStmt, 0);
|
||||
pBlob = (const char*)sqlite3_column_blob(pStmt, 0);
|
||||
j = sqlite3Fts3GetVarint(pBlob, &x);
|
||||
a[0] = nDoc = (u32)(x & 0xffffffff);
|
||||
for(i=0; i<p->nColumn && j<nBlob; i++){
|
||||
j = sqlite3Fts3GetVarint(&pBlob[j], &x);
|
||||
a[1+i*2] = ((u32)(x & 0xffffffff) + nDoc/2)/nDoc;
|
||||
}
|
||||
}
|
||||
sqlite3_reset(pStmt);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Insert the sizes (in tokens) for each column of the document
|
||||
** with docid equal to p->iPrevDocid. The sizes are encoded as
|
||||
|
Reference in New Issue
Block a user