22 #ifndef XAPIAN_INCLUDED_WEIGHTINTERNAL_H
23 #define XAPIAN_INCLUDED_WEIGHTINTERNAL_H
50 double max_part_ = 0.0)
75 #ifdef XAPIAN_ASSERTIONS
83 mutable bool finalised =
false;
147 #ifdef XAPIAN_ASSERTIONS
161 termfreq = reltermfreq = collfreq = 0;
165 termfreq = i->second.termfreq;
166 reltermfreq = i->second.reltermfreq;
167 collfreq = i->second.collfreq;
176 return get_stats(term, termfreq, dummy1, dummy2);
181 #ifdef XAPIAN_ASSERTIONS
194 termweight = i->second.max_part;
204 while (i !=
termfreqs.end() && i->second.max_part == 0.0) ++i;
206 min_tw = max_tw = 0.0;
209 min_tw = max_tw = i->second.max_part;
211 double max_part = i->second.max_part;
212 if (max_part > max_tw) {
214 }
else if (max_part < min_tw && max_part != 0.0) {
226 double& val = i->second.max_part;
227 val = std::max(val, max_part);
232 #ifdef XAPIAN_ASSERTIONS
database class declarations
Base class for databases.
This class is used to access a database, or a group of databases.
Class representing a query.
Class to hold statistics for a given collection.
Xapian::totallength total_length
Total length of all documents in the collection.
std::map< std::string, TermFreqs > termfreqs
Map of term frequencies and relevant term frequencies for the collection.
Xapian::Query query
The query.
Xapian::Database db
Database to get the bounds on doclength and wdf from.
std::string get_description() const
Return a std::string describing this object.
bool have_max_part
Has max_part been set for any term?
bool get_stats(const std::string &term, Xapian::doccount &termfreq) const
Get just the termfreq.
void get_max_termweight(double &min_tw, double &max_tw)
Get the minimum and maximum termweights.
void merge(const Weight::Internal &o)
Xapian::doccount rset_size
Number of relevant documents in the collection.
bool get_stats(const std::string &term, Xapian::doccount &termfreq, Xapian::doccount &reltermfreq, Xapian::termcount &collfreq) const
Get the frequencies for the given term.
Xapian::doccount collection_size
Number of documents in the collection.
Xapian::doclength get_average_length() const
void set_max_part(const std::string &term, double max_part)
Set max_part for a term.
void accumulate_stats(const Xapian::Database::Internal &sub_db, const Xapian::RSet &rset)
Accumulate the rtermfreqs for terms in the query.
Internal & operator+=(const Internal &inc)
Add in the supplied statistics from a sub-database.
void set_query(const Xapian::Query &query_)
bool get_termweight(const std::string &term, double &termweight) const
Get the termweight.
void set_bounds_from_db(const Xapian::Database &db_)
Set the "bounds" stats from Database db.
API for working with Xapian databases.
The Xapian namespace contains public interfaces for the Xapian library.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
double doclength
A normalised document length.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
XAPIAN_TOTALLENGTH_TYPE totallength
The total length of all documents in a database.
Various assertion macros.
size_t sub_db(Xapian::docid did, size_t n_dbs)
The frequencies for a term.
Xapian::termcount collfreq
Xapian::doccount reltermfreq
TermFreqs(Xapian::doccount termfreq_, Xapian::doccount reltermfreq_, Xapian::termcount collfreq_, double max_part_=0.0)
std::string get_description() const
Return a std::string describing this object.
void operator+=(const TermFreqs &other)
Xapian::doccount termfreq