39 BM25Weight::clone()
 const    41     return new BM25Weight(param_k1, param_k2, param_k3, param_b,
    46 BM25Weight::init(
double factor)
    51     if (get_rset_size() != 0) {
    60         AssertRel(reltermfreq,<=,get_rset_size());
    66         AssertRel(reldocs_not_indexed,<=,get_collection_size() - tf);
    71         double numerator = (reltermfreq + 0.5) * (Q - tf + 0.5);
    72         double denom = (reldocs_not_indexed + 0.5) * (nonreldocs_indexed + 0.5);
    73         tw = numerator / denom;
    75         tw = (get_collection_size() - tf + 0.5) / (tf + 0.5);
    96     if (
rare(tw <= 1.0)) {
    99         termweight = log(tw) * factor;
   101             double wqf_double = get_wqf();
   102             termweight *= (param_k3 + 1) * wqf_double / (param_k3 + wqf_double);
   106     if (tw < 2) tw = tw * 0.5 + 1;
   107     termweight = log(tw) * factor;
   109         double wqf_double = get_wqf();
   110         termweight *= (param_k3 + 1) * wqf_double / (param_k3 + wqf_double);
   113     termweight *= (param_k1 + 1);
   117     if (param_k2 == 0 && (param_b == 0 || param_k1 == 0)) {
   122         len_factor = get_average_length();
   125         if (len_factor != 0) len_factor = 1 / len_factor;
   134     return "Xapian::BM25Weight";
   138 BM25Weight::serialise()
 const   149 BM25Weight::unserialise(
const string & s)
 const   151     const char *ptr = s.data();
   152     const char *end = ptr + s.size();
   158     if (
rare(ptr != end))
   160     return new BM25Weight(k1, k2, k3, b, min_normlen);
   167     LOGCALL(WTCALC, 
double, 
"BM25Weight::get_sumpart", wdf | len);
   170     double wdf_double = wdf;
   171     double denom = param_k1 * (normlen * param_b + (1 - param_b)) + wdf_double;
   173     RETURN(termweight * (wdf_double / denom));
   177 BM25Weight::get_maxpart()
 const   179     LOGCALL(WTCALC, 
double, 
"BM25Weight::get_maxpart", NO_ARGS);
   180     double denom = param_k1;
   182     if (param_k1 != 0.0) {
   183         if (param_b != 0.0) {
   193                  max(max(wdf_max, get_doclength_lower_bound()) * len_factor,
   195             denom *= (normlen_lb * param_b + (1 - param_b));
   200     RETURN(termweight * (wdf_max / denom));
   215     LOGCALL(WTCALC, 
double, 
"BM25Weight::get_sumextra", len);
   216     double num = (2.0 * param_k2 * get_query_length());
   217     RETURN(num / (1.0 + max(len * len_factor, param_min_normlen)));
   221 BM25Weight::get_maxextra()
 const   223     LOGCALL(WTCALC, 
double, 
"BM25Weight::get_maxextra", NO_ARGS);
   226     double num = (2.0 * param_k2 * get_query_length());
   227     RETURN(num / (1.0 + max(get_doclength_lower_bound() * len_factor,
   228                             param_min_normlen)));
 The Xapian namespace contains public interfaces for the Xapian library. 
 
#define AssertRel(A, REL, B)
 
Hierarchy of classes which Xapian can throw as exceptions. 
 
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms. 
 
functions to serialise and unserialise a double 
 
double unserialise_double(const char **p, const char *end)
Unserialise a double serialised by serialise_double. 
 
Indicates an error in the std::string serialisation of an object. 
 
double doclength
A normalised document length. 
 
std::string serialise_double(double v)
Serialise a double to a string. 
 
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents. 
 
Various assertion macros. 
 
Xapian::Weight subclass implementing the BM25 probabilistic formula. 
 
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)