30 #include <string_view>
37 LOGCALL_VOID(DB,
"GlassAllTermsList::read_termfreq", NO_ARGS);
38 Assert(!current_term.empty());
40 Assert(!cursor->after_end());
44 const char *
p = cursor->current_tag.data();
45 const char *pend =
p + cursor->current_tag.size();
61 return database->postlist_table.get_entry_count();
68 Assert(!current_term.empty());
70 Assert(!cursor->after_end());
71 if (termfreq == 0) read_termfreq();
84 cursor = database->postlist_table.cursor_get();
88 (void)cursor->find_entry_ge(
string(
"\x00\xff", 2));
91 if (cursor->find_entry_ge(key)) {
94 current_term = prefix;
98 if (cursor->after_end()) {
104 Assert(!cursor->after_end());
106 if (!cursor->next()) {
112 auto nul = cursor->current_key.find(
'\0');
113 if (nul == string::npos) {
114 current_term = cursor->current_key;
117 if (cursor->current_key[nul + 1] !=
'\xff') {
121 const char *
p = cursor->current_key.data();
122 const char *pend =
p + cursor->current_key.size();
130 if (
p == pend)
break;
150 cursor = database->postlist_table.cursor_get();
153 Assert(!cursor->after_end());
156 if (cursor->find_entry_ge(key)) {
161 if (cursor->after_end()) {
165 const char *
p = cursor->current_key.data();
166 const char *pend =
p + cursor->current_key.size();
Xapian::doccount get_termfreq() const
Returns the term frequency of the current term.
TermList * next()
Advance to the next term in the list.
TermList * skip_to(std::string_view tname)
Advance to the first term which is >= tname.
void read_termfreq() const
Read and cache the term frequency.
~GlassAllTermsList()
Destructor.
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)