Home | History | Annotate | Download | only in fts1

Lines Matching refs:DocList

157  * A doclist with type DL_POSITIONS_OFFSETS is stored like this:
175 * A doclist with type DL_POSITIONS is like the above, but holds only docids
178 * A doclist with type DL_DOCIDS is like the above, but holds only docids
182 * to serialize a doclist's type.
234 typedef struct DocList {
241 } DocList;
249 /* Initialize a new DocList to hold the given data. */
250 static void docListInit(DocList *d, DocListType iType,
264 /* Create a new dynamically-allocated DocList. */
265 static DocList *docListNew(DocListType iType){
266 DocList *d = (DocList *) malloc(sizeof(DocList));
271 static void docListDestroy(DocList *d){
278 static void docListDelete(DocList *d){
283 static char *docListEnd(DocList *d){
287 /* Append a varint to a DocList's data. */
288 static void appendVarint(DocList *d, sqlite_int64 i){
296 static void docListAddDocid(DocList *d, sqlite_int64 iDocid){
306 static void addPos(DocList *d, int iColumn, int iPos){
321 /* Add a position to the last position list in a doclist. */
322 static void docListAddPos(DocList *d, int iColumn, int iPos){
329 ** Add a position and starting and ending offsets to a doclist.
331 ** If the doclist is setup to handle only positions, then insert
335 DocList *d, /* Doclist under construction */
354 ** A DocListReader object is a cursor into a doclist. Initialize
355 ** the cursor to the beginning of the doclist by calling readerInit().
364 ** to read information out of the doclist. When we reach the end
365 ** of the doclist, atEnd() returns TRUE.
368 DocList *pDoclist; /* The document list we are stepping through */
369 char *p; /* Pointer to next unread byte in the doclist */
377 static void readerInit(DocListReader *r, DocList *pDoclist){
457 DocList *p = pReader->pDoclist;
464 /* Skip over a docid, including its position list if the doclist has
483 static sqlite_int64 firstDocid(DocList *d){
493 ** Write the content of a doclist to standard output.
495 static void printDoclist(DocList *p){
524 /* Trim the given doclist to contain only positions in column
526 static void docListRestrictColumn(DocList *in, int iRestrictColumn){
528 DocList out;
550 /* Trim the given doclist by discarding any docids without any remaining
552 static void docListDiscardEmpty(DocList *in) {
554 DocList out;
580 ** Splices a doclist element into the doclist represented by r,
585 DocList *d = r->pDoclist;
622 /* Insert/update pUpdate into the doclist. */
623 static void docListUpdate(DocList *d, DocList *pUpdate){
637 static void docListAccumulate(DocList *pAcc, DocList *pUpdate){
640 /* Handle edge cases where one doclist is empty. */
692 DocList *pOut /* Write the merged document record here */
731 DocList *pLeft, /* Doclist resulting from the words on the left */
732 DocList *pRight, /* Doclist for the next word to the right */
733 DocList *pOut /* Write the combined doclist here */
763 DocList *pLeft, /* Doclist resulting from the words on the left */
764 DocList *pRight, /* Doclist for the next word to the right */
765 DocList *pOut /* Write the combined doclist here */
797 DocList *pLeft, /* Doclist resulting from the words on the left */
798 DocList *pRight, /* Doclist for the next word to the right */
799 DocList *pOut /* Write the combined doclist here */
842 DocList *pLeft, /* Doclist resulting from the words on the left */
843 DocList *pRight, /* Doclist for the next word to the right */
844 DocList *pOut /* Write the combined doclist here */
1032 ** cost of adding new elements to the segment 0 doclist, and it seems
1068 "select rowid, doclist from %_term where term = ? and segment = ?",
1070 "select doclist from %_term where term = ? order by segment",
1072 "insert into %_term (rowid, term, segment, doclist) values (?, ?, ?, ?)",
1073 /* TERM_UPDATE */ "update %_term set doclist = ? where rowid = ?",
1349 /* select rowid, doclist from %_term
1352 * returned doclist. If no rows found, returns SQLITE_DONE. */
1355 sqlite_int64 *rowid, DocList *out){
1382 ** doclist in out.
1395 DocList *out /* Write the resulting doclist here */
1397 DocList doclist;
1405 docListInit(&doclist, DL_DEFAULT, 0, 0);
1409 DocList old;
1424 /* doclist contains the newer data, so write it over old. Then
1425 ** steal accumulated result for doclist.
1427 docListAccumulate(&old, &doclist);
1428 docListDestroy(&doclist);
1429 doclist = old;
1432 docListDestroy(&doclist);
1436 docListDiscardEmpty(&doclist);
1437 *out = doclist;
1441 /* insert into %_term (rowid, term, segment, doclist)
1442 values ([piRowid], [pTerm], [iSegment], [doclist])
1450 int iSegment, DocList *doclist){
1468 rc = sqlite3_bind_blob(s, 4, doclist->pData, doclist->nData, SQLITE_STATIC);
1474 /* update %_term set doclist = [doclist] where rowid = [rowid] */
1476 DocList *doclist){
1481 rc = sqlite3_bind_blob(s, 1, doclist->pData, doclist->nData, SQLITE_STATIC);
2035 ** Additionally, doclist blobs are chunked into multiple segments,
2038 ** segment 0 is deleted, and the doclist is inserted at segment 1.
2039 ** If there is already a doclist at segment 1, the segment 0 doclist
2040 ** is merged with it, the segment 1 doclist is deleted, and the
2041 ** merged doclist is inserted at segment 2, repeating those
2075 "create table %_term(term text, segment integer, doclist blob, "
2581 /* Return a DocList corresponding to the query term *pTerm. If *pTerm
2583 ** query and return the doclist for the entire phrase query.
2585 ** The result is stored in pTerm->doclist.
2591 DocList **ppResult /* Write the result here */
2593 DocList *pLeft, *pRight, *pNew;
2780 DocList **pResult, /* Write the result doclist here */
2784 DocList *pLeft = NULL;
2785 DocList *pRight, *pNew, *pOr;
2909 DocList *pResult;
2987 DocList *p;
3017 DocList *d){
3019 DocList doclist;
3022 rc = term_select(v, pTerm, nTerm, iSegment, &iIndexRow, &doclist);
3024 docListInit(&doclist, DL_DEFAULT, 0, 0);
3025 docListUpdate(&doclist, d);
3026 /* TODO(shess) Consider length(doclist)>CHUNK_MAX? */
3027 rc = term_insert(v, NULL, pTerm, nTerm, iSegment, &doclist);
3032 docListUpdate(&doclist, d);
3033 if( doclist.nData<=CHUNK_MAX ){
3034 rc = term_update(v, iIndexRow, &doclist);
3038 /* Doclist doesn't fit, delete what's there, and accumulate
3044 /* Try to insert the doclist into a higher segment bucket. On
3045 ** failure, accumulate existing doclist with the doclist from that
3050 &doclist))!=SQLITE_OK ){
3052 DocList old;
3067 /* doclist contains the newer data, so accumulate it over old.
3068 ** Then steal accumulated data for doclist.
3070 docListAccumulate(&old, &doclist);
3071 docListDestroy(&doclist);
3072 doclist = old;
3078 docListDestroy(&doclist);
3137 /* Generate an empty doclist for each term that previously appeared in this
3192 DocList *p = fts1HashData(e);
3200 DocList *p = fts1HashData(e);