39 LOGCALL_VOID(DB,
"GlassPositionListTable::pack", s | vec);
60 const char *
pos = data.data();
61 const char * end =
pos + data.size();
80 string_view
term)
const
85 if (!get_exact_entry(make_key(did,
term), data)) {
89 RETURN(positionlist_count(data));
97 LOGCALL_VOID(DB,
"GlassBasePositionList::set_data", data);
109 const char*
pos = data.data();
110 const char* end =
pos + data.size();
119 current_pos = last = pos_last;
126 rd.decode_interpolative(0, pos_size - 1, pos_first, pos_last);
129 current_pos = pos_first;
157 LOGCALL(DB,
bool,
"GlassBasePositionList::next", NO_ARGS);
158 if (
rare(!have_started)) {
160 return current_pos <= last;
162 if (current_pos == last) {
165 current_pos = rd.decode_interpolative_next();
181 while (current_pos <
termpos) {
182 if (current_pos == last) {
185 current_pos = rd.decode_interpolative_next();
194 pos_data = std::move(data);
202 LOGCALL_VOID(DB,
"GlassRePositionList::assign_data", data);
207 cursor.current_tag = std::move(data);
209 set_data(cursor.current_tag);
219 cursor.current_tag.clear();
222 set_data(cursor.current_tag);
Classes to encode/decode a bitstream.
bool next()
Advance to the next term position in the list.
bool skip_to(Xapian::termpos termpos)
Advance to the first term position which is at least termpos.
Xapian::termpos get_position() const
Returns current position.
Xapian::termcount get_approx_size() const
Returns size of position list.
void set_data(std::string_view data)
Set positional data and start to decode it.
Xapian::termpos back() const
Return the final entry in this positionlist.
Xapian::termcount positionlist_count(std::string_view data) const
Return the number of entries in specified position list data.
void pack(std::string &s, const Xapian::VecCOW< Xapian::termpos > &vec) const
Pack a position list into a string.
static std::string make_key(Xapian::docid did, std::string_view term)
GlassPositionList(const GlassPositionList &)=delete
Copying is not allowed.
void assign_data(std::string &&data)
Fill list with data, and move the position to the start.
void read_data(Xapian::docid did, std::string_view term)
Fill list with data, and move the position to the start.
Read a stream created by BitWriter.
Xapian::termpos decode(Xapian::termpos outof, bool force=false)
Create a stream to which non-byte-aligned values can be written.
void encode(Xapian::termpos value, Xapian::termpos outof)
Encode value, known to be less than outof.
std::string & freeze()
Finish encoding and return the encoded data as a std::string.
void encode_interpolative(const Xapian::VecCOW< Xapian::termpos > &pos, int j, int k)
Perform interpolative encoding of pos elements between j and k.
DatabaseCorruptError indicates database corruption was detected.
Suitable for "simple" type T.
#define LOGCALL(CATEGORY, TYPE, FUNC, PARAMS)
#define LOGCALL_CTOR(CATEGORY, CLASS, PARAMS)
#define LOGCALL_VOID(CATEGORY, FUNC, PARAMS)
A position list in a glass database.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
unsigned XAPIAN_TERMPOS_BASE_TYPE termpos
A term position within a document or query.
Pack types into strings and unpack them again.
bool unpack_uint(const char **p, const char *end, U *result)
Decode an unsigned integer from a string.
void pack_uint(std::string &s, U value)
Append an encoded unsigned integer to a string.