31 #include <string_view>
38 LOGCALL_VOID(DB,
"GlassAllTermsList::read_termfreq", NO_ARGS);
39 Assert(!current_term.empty());
41 Assert(!cursor->after_end());
45 const char *
p = cursor->current_tag.data();
46 const char *pend =
p + cursor->current_tag.size();
62 auto entry_count = database->postlist_table.get_entry_count();
63 return clamp_cast<Xapian::termcount>(entry_count);
70 Assert(!current_term.empty());
72 Assert(!cursor->after_end());
73 if (termfreq == 0) read_termfreq();
86 cursor = database->postlist_table.cursor_get();
90 (void)cursor->find_entry_ge(
string(
"\x00\xff", 2));
93 if (cursor->find_entry_ge(key)) {
96 current_term = prefix;
100 if (cursor->after_end()) {
106 Assert(!cursor->after_end());
108 if (!cursor->next()) {
114 auto nul = cursor->current_key.find(
'\0');
115 if (nul == string::npos) {
116 current_term = cursor->current_key;
119 if (cursor->current_key[nul + 1] !=
'\xff') {
123 const char *
p = cursor->current_key.data();
124 const char *pend =
p + cursor->current_key.size();
132 if (
p == pend)
break;
152 cursor = database->postlist_table.cursor_get();
155 Assert(!cursor->after_end());
158 if (cursor->find_entry_ge(key)) {
163 if (cursor->after_end()) {
167 const char *
p = cursor->current_key.data();
168 const char *pend =
p + cursor->current_key.size();
Cast a value to a type, clamping out of range values.
Xapian::doccount get_termfreq() const
Returns the term frequency of the current term.
TermList * next()
Advance to the next term in the list.
void read_termfreq() const
Read and cache the term frequency.
~GlassAllTermsList()
Destructor.
TermList * skip_to(std::string_view term)
Advance to the first term which is >= term.
Xapian::termcount get_approx_size() const
Return approximate size of this termlist.
static void read_freqs(const char **posptr, const char *end, Xapian::doccount *number_of_entries_ptr, Xapian::termcount *collection_freq_ptr)
Read the term frequency and collection frequency.
DatabaseCorruptError indicates database corruption was detected.
Abstract base class for termlists.
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
#define LOGCALL_VOID(CATEGORY, FUNC, PARAMS)
#define LOGCALL_DTOR(CATEGORY, CLASS)
A termlist containing all terms in a glass database.
Postlists in glass databases.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Pack types into strings and unpack them again.
bool unpack_string_preserving_sort(const char **p, const char *end, std::string &result)
Decode a "sort preserved" std::string from a string.
std::string pack_glass_postlist_key(std::string_view term)
Various handy string-related helpers.
bool startswith(std::string_view s, char pfx)