Changeset 52

Show
Ignore:
Timestamp:
1999-09-17 10:58:08 (9 years ago)
Author:
richard
Message:

Reads postlists from DA files.

Location:
trunk/xapian-core
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/xapian-core/backends/da/da_database.cc

    r50 r52  
    1111DAPostList::DAPostList(struct postings *pl) { 
    1212    postlist = pl; 
    13     //currdoc  = da_postlist_nextitem(pl); 
     13    DAreadpostings(postlist, 0, 0); 
    1414} 
    1515 
     
    2020docid DAPostList::get_docid() { 
    2121    if(at_end()) throw OmError("Attempt to access beyond end of postlist."); 
    22     return currdoc; 
     22    return postlist->Doc; 
    2323} 
    2424 
    2525weight DAPostList::get_weight() { 
    2626    if(at_end()) throw OmError("Attempt to access beyond end of postlist."); 
    27     return 1; 
     27    return postlist->wdf; 
    2828} 
    2929 
    3030void DAPostList::next() { 
    3131    if(at_end()) throw OmError("Attempt to access beyond end of postlist."); 
    32     //currdoc = da_postlist_nextitem(postlist); 
     32    DAreadpostings(postlist, 0, 0); 
    3333} 
    3434 
    3535void DAPostList::skip_to(docid id) { 
    3636    if(at_end()) throw OmError("Attempt to access beyond end of postlist."); 
    37     while (!at_end() && get_docid() < id) { 
    38         next(); 
    39     } 
     37    DAreadpostings(postlist, 0, id); 
    4038} 
    4139 
    4240bool DAPostList::at_end() { 
    43     if(currdoc == 0) return true; 
     41    if(postlist->Doc == MAXINT) return true; 
    4442    return false; 
    4543} 
  • trunk/xapian-core/tests/dbtest.cc

    r49 r52  
    1212    try { 
    1313        database.open("testdir", 0); 
    14         tid = database.term_name_to_id("a"); 
     14        tid = database.term_name_to_id("abhor"); 
    1515        // posting list 122 141 142 174 ... 
    1616        postlist = database.open_post_list(tid); 
     
    2222            wt = postlist->get_weight(); 
    2323            printf("TermId: %d  DocId: %d  Weight: %d\n", tid, did, wt); 
    24             if(did == 2) postlist->skip_to(5); 
     24            if(did == 120) postlist->skip_to(144); 
    2525            else postlist->next(); 
    2626        }