39 TermFreqs::get_description()
const {
40 string desc(
"TermFreqs(termfreq=");
41 desc +=
str(termfreq);
42 desc +=
", reltermfreq=";
43 desc +=
str(reltermfreq);
44 desc +=
", collfreq=";
45 desc +=
str(collfreq);
46 desc +=
", max_part=";
47 desc +=
str(max_part);
57 #ifdef XAPIAN_ASSERTIONS
65 db_doclength_lower_bound =
min_non_zero(db_doclength_lower_bound,
67 db_doclength_upper_bound = std::max(db_doclength_upper_bound,
70 db_unique_terms_lower_bound =
min_non_zero(db_unique_terms_lower_bound,
72 db_unique_terms_upper_bound = std::max(db_unique_terms_upper_bound,
77 termfreqs[i.first] += i.second;
86 #ifdef XAPIAN_ASSERTIONS
92 rset_size += rset.
size();
94 db_doclength_lower_bound =
min_non_zero(db_doclength_lower_bound,
96 db_doclength_upper_bound = std::max(db_doclength_upper_bound,
98 db_unique_terms_lower_bound =
101 db_unique_terms_upper_bound =
102 std::max(db_unique_terms_upper_bound,
107 const string &
term = *t;
126 for (
auto&& i : termfreqs) {
127 const string&
term = i.first;
134 if (
term == tl->get_termname())
135 ++i.second.reltermfreq;
145 double& max_part = termfreqs[i.first].max_part;
146 max_part = max(max_part, i.second.max_part);
151 Weight::Internal::get_description()
const
153 string desc =
"Weight::Internal(totlen=";
154 desc +=
str(total_length);
155 desc +=
", collection_size=";
156 desc +=
str(collection_size);
157 desc +=
", rset_size=";
158 desc +=
str(rset_size);
159 #ifdef XAPIAN_ASSERTIONS
162 desc +=
", finalised=";
163 desc +=
str(finalised);
165 desc +=
", termfreqs={";
166 for (
auto i = termfreqs.begin(); i != termfreqs.end(); ++i) {
167 if (i != termfreqs.begin())
171 desc += i->second.get_description();
static Xapian::Query query(Xapian::Query::op op, const string &t1=string(), const string &t2=string(), const string &t3=string(), const string &t4=string(), const string &t5=string(), const string &t6=string(), const string &t7=string(), const string &t8=string(), const string &t9=string(), const string &t10=string())
Virtual base class for Database internals.
virtual TermList * open_term_list(docid did) const =0
virtual termcount get_unique_terms_lower_bound() const
Get a lower bound on the unique terms size of a document in this DB.
virtual termcount get_doclength_upper_bound() const =0
Get an upper bound on the length of a document in this DB.
virtual totallength get_total_length() const =0
Return the total length of all documents in this database.
virtual void get_freqs(std::string_view term, doccount *termfreq_ptr, termcount *collfreq_ptr) const =0
Returns frequencies for a term.
virtual doccount get_doccount() const =0
virtual termcount get_unique_terms_upper_bound() const
Get an upper bound on the unique terms size of a document in this DB.
virtual termcount get_doclength_lower_bound() const =0
Get a lower bound on the length of a document in this DB.
const TermIterator get_unique_terms_begin() const
Begin iterator for unique terms in the query object.
Class representing a set of documents judged as relevant.
Xapian::Internal::intrusive_ptr< Internal > internal
Xapian::doccount size() const
Return number of documents in this RSet object.
Abstract base class for termlists.
virtual Internal * skip_to(std::string_view term)=0
Skip forward to the specified term.
Class for iterating over a list of terms.
Class to hold statistics for a given collection.
Xapian::totallength total_length
Total length of all documents in the collection.
Xapian::termcount db_doclength_upper_bound
An upper bound on the maximum length of any document in the database.
bool have_max_part
Has max_part been set for any term?
Xapian::termcount db_doclength_lower_bound
A lower bound on the minimum length of any document in the database.
Xapian::termcount db_unique_terms_lower_bound
A lower bound on the number of unique terms in any document.
Xapian::doccount rset_size
Number of relevant documents in the collection.
Xapian::doccount collection_size
Number of documents in the collection.
std::map< std::string, TermFreqs, std::less<> > termfreqs
Map of term frequencies and relevant term frequencies for the collection.
Xapian::termcount db_unique_terms_upper_bound
An upper bound on the number of unique terms in any document.
Return the smaller of two numbers which isn't zero.
constexpr std::enable_if_t< std::is_unsigned_v< T >, T > min_non_zero(const T &a, const T &b)
Return the smaller of two unsigned integers which isn't zero.
string str(int value)
Convert int to std::string.
The Xapian namespace contains public interfaces for the Xapian library.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Various assertion macros.
Set of documents judged as relevant.
Convert types to std::string.
The frequencies for a term.
Xapian::doccount termfreq
Xapian::termcount collfreq
Abstract base class for termlists.
Xapian::Weight::Internal class, holding database and term statistics.