Changeset 57

Show
Ignore:
Timestamp:
1999-09-17 14:18:21 (9 years ago)
Author:
richard
Message:

Added get_termfreq() method to postlists.

Location:
trunk/xapian-core
Files:
4 modified

Legend:

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

    r55 r57  
    99#include "daread.h" 
    1010 
    11 DAPostList::DAPostList(struct postings *pl) { 
     11DAPostList::DAPostList(struct postings *pl, doccount tf) { 
     12    termfreq = tf; 
    1213    postlist = pl; 
    1314    DAreadpostings(postlist, 0, 0); 
     
    1617DAPostList::~DAPostList() { 
    1718    DAclosepostings(postlist); 
     19} 
     20 
     21doccount DAPostList::get_termfreq() { 
     22    return termfreq; 
    1823} 
    1924 
     
    112117    postlist = DAopenpostings(&ti, DA_t); 
    113118 
    114     DAPostList * pl = new DAPostList(postlist); 
     119    DAPostList * pl = new DAPostList(postlist, ti.freq); 
    115120    return pl; 
    116121} 
     
    130135    if (!id) { 
    131136        id = termidvec.size() + 1; 
    132         printf("Adding term `%s' as ID %d\n", name.c_str(), id); 
     137//      printf("Adding term `%s' as ID %d\n", name.c_str(), id); 
    133138        termidvec.push_back(name); 
    134139        termidmap[name] = id; 
    135140    } 
    136     printf("Looking up term `%s': ID = %d\n", name.c_str(), id); 
     141//    printf("Looking up term `%s': ID = %d\n", name.c_str(), id); 
    137142    return id; 
    138143} 
     
    142147{ 
    143148    if (id <= 0 || id > termidvec.size()) throw RangeError("invalid termid"); 
    144     printf("Looking up termid %d: name = `%s'\n", id, termidvec[id - 1].c_str()); 
     149//    printf("Looking up termid %d: name = `%s'\n", id, termidvec[id - 1].c_str()); 
    145150    return termidvec[id - 1]; 
    146151} 
  • trunk/xapian-core/backends/da/da_database.h

    r37 r57  
    1212        struct postings * postlist; 
    1313        docid  currdoc; 
     14        doccount termfreq; 
    1415 
    15         DAPostList(struct postings *pl); 
     16        DAPostList(struct postings *pl, doccount tf); 
    1617    public: 
    1718        ~DAPostList(); 
     19 
     20        doccount get_termfreq();  
    1821 
    1922        docid  get_docid();     // Gets current docid 
  • trunk/xapian-core/common/database.h

    r37 r57  
    3939    private: 
    4040    public: 
     41        virtual doccount get_termfreq() = 0;// Gets number of docs indexed by this term 
     42 
    4143        virtual docid  get_docid() = 0;     // Gets current docid 
    4244        virtual weight get_weight() = 0;    // Gets current weight 
  • trunk/xapian-core/common/omtypes.h

    r55 r57  
    66typedef unsigned int termid; 
    77typedef unsigned int docid; 
     8 
     9typedef docid doccount; 
     10 
    811typedef unsigned int weight; 
    912