34 InL2Weight::InL2Weight(
double c)
65 if (wdfn_upper == 0) {
78 double maximum_wdfn_product_L = wdfn_upper / (wdfn_upper + 1.0);
81 double idf_max =
log2((N + 1) / (termfreq + 0.5));
93 return "Xapian::InL2Weight";
105 const char *ptr = s.data();
106 const char *end = ptr + s.size();
108 if (
rare(ptr != end))
117 if (wdf == 0)
return 0.0;
122 double wdfn_product_L = wdfn / (wdfn + 1.0);
The Xapian namespace contains public interfaces for the Xapian library.
Xapian::doccount get_collection_size() const
The number of documents in the collection.
void init(double factor)
Allow the subclass to perform any initialisation it needs to.
InL2Weight * unserialise(const std::string &serialised) const
Unserialise parameters.
This class implements the InL2 weighting scheme.
double get_sumextra(Xapian::termcount doclen, Xapian::termcount uniqterms) const
Calculate the term-independent weight component for a document.
std::string serialise() const
Return this object's parameters serialised as a single string.
Lower bound on (non-zero) document lengths.
double get_maxextra() const
Return an upper bound on what get_sumextra() can return for any document.
double wqf_product_idf
The constant values which are used on every call to get_sumpart().
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
Length of the current document (sum wdf).
InvalidArgumentError indicates an invalid parameter value was passed to the API.
Xapian::termcount get_doclength_lower_bound() const
A lower bound on the minimum length of any document in the shard.
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.
Within-query-frequency of the current term.
Average length of documents in the collection.
std::string name() const
Return the name of this weighting scheme.
Xapian::termcount get_wqf() const
The within-query-frequency of this term.
double upper_bound
The upper bound on the weight a term can give to a document.
double get_maxpart() const
Return an upper bound on what get_sumpart() can return for any document.
double get_sumpart(Xapian::termcount wdf, Xapian::termcount doclen, Xapian::termcount uniqterms) const
Calculate the weight contribution for this object's term to a document.
Within-document-frequency of the current term in the current document.
Xapian::doccount get_termfreq() const
The number of documents which this term indexes.
How many documents the current term is in.
Xapian::doclength get_average_length() const
The average length of a document in the collection.
std::string serialise_double(double v)
Serialise a double to a string.
double param_c
The wdf normalization parameter in the formula.
Number of documents in the collection.
Defines a log2() function to find the logarithm to base 2 if not already defined in the library...
void need_stat(stat_flags flag)
Tell Xapian that your subclass will want a particular statistic.
Xapian::termcount get_wdf_upper_bound() const
An upper bound on the wdf of this term in the shard.
InL2Weight * clone() const
Clone this object.