Home | History | Annotate | Download | only in fts1

Lines Matching refs:DocList

87  * A doclist with type DL_POSITIONS_OFFSETS is stored like this:
100 * A doclist with type DL_POSITIONS is like the above, but holds only docids
103 * A doclist with type DL_DOCIDS is like the above, but holds only docids
107 * to serialize a doclist's type.
129 typedef struct DocList {
135 } DocList;
137 /* Initialize a new DocList to hold the given data. */
138 static void docListInit(DocList *d, DocListType iType,
152 /* Create a new dynamically-allocated DocList. */
153 static DocList *docListNew(DocListType iType){
154 DocList *d = (DocList *) malloc(sizeof(DocList));
159 static void docListDestroy(DocList *d){
166 static void docListDelete(DocList *d){
171 static char *docListEnd(DocList *d){
175 /* Append a varint to a DocList's data. */
176 static void appendVarint(DocList *d, sqlite_int64 i){
184 static void docListAddDocid(DocList *d, sqlite_int64 iDocid){
189 /* Add a position to the last position list in a doclist. */
190 static void docListAddPos(DocList *d, int iPos){
196 static void docListAddPosOffset(DocList *d, int iPos,
205 /* Terminate the last position list in the given doclist. */
206 static void docListAddEndPos(DocList *d){
211 DocList *pDoclist;
216 static void readerInit(DocListReader *r, DocList *pDoclist){
274 /* Skip over a docid, including its position list if the doclist has
283 static sqlite_int64 firstDocid(DocList *d){
289 /* Doclist multi-tool. Pass pUpdate==NULL to delete the indicated docid;
292 static int docListUpdate(DocList *d, sqlite_int64 iDocid, DocList *pUpdate){
333 /* Split the second half of doclist d into a separate doclist d2. Returns 1
336 static int docListSplit(DocList *d, DocList *d2){
351 /* A DocListMerge computes the AND of an in-memory DocList [in] and a chunked
352 * on-disk doclist, resulting in another in-memory DocList [out]. [in]
354 * caller's wishes. The on-disk doclist always comes with positions.
356 * The caller must read each chunk of the on-disk doclist in succession and
364 * If [in] is NULL, then the on-disk doclist is copied to [out] directly.
367 * [iOffset] is subtracted from each position in the on-disk doclist for the
376 DocList *pOut;
381 DocList *pIn, int iOffset, DocList *pOut){
422 /* Merge one block of an on-disk doclist into a DocListMerge. */
423 static void mergeBlock(DocListMerge *m, DocList *pBlock){
446 /* Copy all positions to the output doclist. */
553 "select rowid, doclist from %_term where term = ? and first = ?",
557 doclist) values (?, ?, ?)",
558 /* TERM_UPDATE */ "update %_term set doclist = ? where rowid = ?",
716 /* select rowid, doclist from %_term where term = [zTerm] and first = [iFirst]
717 * If found, returns SQLITE_OK; the caller must free the returned doclist.
722 DocList *out){
781 /* insert into %_term (term, first, doclist)
782 values ([zTerm], [iFirst], [doclist]) */
784 sqlite_int64 iFirst, DocList *doclist){
795 rc = sqlite3_bind_blob(s, 3, doclist->pData, doclist->nData, SQLITE_STATIC);
801 /* update %_term set doclist = [doclist] where rowid = [rowid] */
803 DocList *doclist){
808 rc = sqlite3_bind_blob(s, 1, doclist->pData, doclist->nData,
920 ** Additionally, doclist blobs can be chunked into multiple rows,
926 ** deletion, which can leave a doclist that doesn't contain the
933 "create table %_term(term text, first integer, doclist blob);"
1051 "select doclist from %_term where term = ? order by first");
1061 /* Read the posting list for [zTerm]; AND it with the doclist [in] to
1062 * produce the doclist [out], using the given offset [iOffset] for phrase
1069 DocList *pIn, int iOffset, DocList *out){
1084 DocList block;
1194 DocList **pResult){
1199 DocList *d = NULL;
1209 DocList *next = docListNew(need_positions ? DL_POSITIONS : DL_DOCIDS);
1244 DocList *pResult;
1304 DocList *p;
1332 sqlite_int64 iDocid, DocList *p){
1335 DocList doclist;
1339 docListInit(&doclist, DL_POSITIONS_OFFSETS, 0, 0);
1340 if( docListUpdate(&doclist, iDocid, p) ){
1341 rc = term_insert(v, zTerm, nTerm, iDocid, &doclist);
1342 docListDestroy(&doclist);
1351 rc = term_select(v, zTerm, nTerm, iFirst, &iIndexRow, &doclist);
1354 if( docListUpdate(&doclist, iDocid, p) ){
1356 if( doclist.nData>CHUNK_MAX ){
1357 DocList half;
1358 if( docListSplit(&doclist, &half) ){
1364 rc = term_update(v, iIndexRow, &doclist);
1368 docListDestroy(&doclist);
1390 DocList *p = HashData(e);
1396 DocList *p = HashData(e);
1407 DocList doclist;
1412 rc = term_select(v, zTerm, nTerm, iFirst, &iIndexRow, &doclist);
1415 if( docListUpdate(&doclist, iDocid, NULL) ){
1416 if( doclist.nData>0 ){
1417 rc = term_update(v, iIndexRow, &doclist);
1422 docListDestroy(&doclist);
1444 DocList *p = HashData(e);