Changeset 52
- Timestamp:
- 1999-09-17 10:58:08 (9 years ago)
- Location:
- trunk/xapian-core
- Files:
-
- 2 modified
-
backends/da/da_database.cc (modified) (2 diffs)
-
tests/dbtest.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xapian-core/backends/da/da_database.cc
r50 r52 11 11 DAPostList::DAPostList(struct postings *pl) { 12 12 postlist = pl; 13 //currdoc = da_postlist_nextitem(pl);13 DAreadpostings(postlist, 0, 0); 14 14 } 15 15 … … 20 20 docid DAPostList::get_docid() { 21 21 if(at_end()) throw OmError("Attempt to access beyond end of postlist."); 22 return currdoc;22 return postlist->Doc; 23 23 } 24 24 25 25 weight DAPostList::get_weight() { 26 26 if(at_end()) throw OmError("Attempt to access beyond end of postlist."); 27 return 1;27 return postlist->wdf; 28 28 } 29 29 30 30 void DAPostList::next() { 31 31 if(at_end()) throw OmError("Attempt to access beyond end of postlist."); 32 //currdoc = da_postlist_nextitem(postlist);32 DAreadpostings(postlist, 0, 0); 33 33 } 34 34 35 35 void DAPostList::skip_to(docid id) { 36 36 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); 40 38 } 41 39 42 40 bool DAPostList::at_end() { 43 if( currdoc == 0) return true;41 if(postlist->Doc == MAXINT) return true; 44 42 return false; 45 43 } -
trunk/xapian-core/tests/dbtest.cc
r49 r52 12 12 try { 13 13 database.open("testdir", 0); 14 tid = database.term_name_to_id("a ");14 tid = database.term_name_to_id("abhor"); 15 15 // posting list 122 141 142 174 ... 16 16 postlist = database.open_post_list(tid); … … 22 22 wt = postlist->get_weight(); 23 23 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); 25 25 else postlist->next(); 26 26 }
