36 DPHWeight::clone()
 const    42 DPHWeight::init(
double factor)
    53     double F = get_collection_freq();
    54     double wdf_lower = 1.0;
    55     double wdf_upper = get_wdf_upper_bound();
    57     double len_upper = get_doclength_upper_bound();
    64     double min_wdf_to_len = wdf_lower / len_upper;
    67     log_constant = 
log2(get_total_length() / F);
    68     wqf_product_factor = get_wqf() * factor;
    75     double max_product_1 = wdf_upper * (1.0 - min_wdf_to_len);
    79     double wdf_var = min(wdf_upper, len_upper / 2.0);
    80     double max_product_2 = wdf_var * (1.0 - wdf_var / len_upper);
    82     double max_product = min(max_product_1, max_product_2);
    96     double wdf_root = 0.25 * (sqrt(8.0 * len_upper + 9.0) - 3.0);
    99     if (wdf_root > wdf_upper) {
   100         wdf_root = wdf_upper;
   101     } 
else if (wdf_root < wdf_lower) {
   102         wdf_root = wdf_lower;
   105     double x = 1 - wdf_root / len_upper;
   106     double x_squared = x * x;
   107     auto max_wdf_product_normalization = wdf_root / (wdf_root + 1) * x_squared;
   109     double max_weight = max_wdf_product_normalization *
   110         (log_constant + (0.5 * 
log2(2 * M_PI * max_product)));
   112     upper_bound = wqf_product_factor * max_weight;
   113     if (
rare(upper_bound < 0.0)) upper_bound = 0.0;
   119     return "Xapian::DPHWeight";
   123 DPHWeight::serialise()
 const   129 DPHWeight::unserialise(
const string& s)
 const   131     if (
rare(!s.empty()))
   140     if (wdf == 0 || wdf == len) 
return 0.0;
   142     double wdf_to_len = double(wdf) / len;
   144     double x = 1 - wdf_to_len;
   145     double normalization = x * x / (wdf + 1);
   147     double wt = normalization *
   148         (wdf * (
log2(wdf_to_len) + log_constant) +
   149          (0.5 * 
log2(2 * M_PI * wdf * (1 - wdf_to_len))));
   150     if (
rare(wt <= 0.0)) 
return 0.0;
   152     return wqf_product_factor * wt;
   156 DPHWeight::get_maxpart()
 const   168 DPHWeight::get_maxextra()
 const The Xapian namespace contains public interfaces for the Xapian library. 
 
Hierarchy of classes which Xapian can throw as exceptions. 
 
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms. 
 
Indicates an error in the std::string serialisation of an object. 
 
This class implements the DPH weighting scheme. 
 
Defines a log2() function to find the logarithm to base 2 if not already defined in the library...