56 string_view
term)
const
61 if (!get_exact_entry(make_key(did,
term), data)) {
65 const char*
pos = data.data();
66 const char* end =
pos + data.size();
88 LOGCALL_VOID(DB,
"HoneyBasePositionList::set_data", data);
100 const char*
pos = data.data();
101 const char* end =
pos + data.size();
110 current_pos = last = pos_last;
117 rd.decode_interpolative(0, pos_size - 1, pos_first, pos_last);
120 current_pos = pos_first;
148 LOGCALL(DB,
bool,
"HoneyBasePositionList::next", NO_ARGS);
149 if (
rare(!have_started)) {
151 return current_pos <= last;
153 if (current_pos == last) {
156 current_pos = rd.decode_interpolative_next();
172 while (current_pos <
termpos) {
173 if (current_pos == last) {
176 current_pos = rd.decode_interpolative_next();
185 pos_data = std::move(data);
193 LOGCALL_VOID(DB,
"HoneyRePositionList::assign_data", data);
198 cursor.current_tag = std::move(data);
200 set_data(cursor.current_tag);
210 cursor.current_tag.clear();
215 set_data(cursor.current_tag);
Classes to encode/decode a bitstream.
void set_data(const std::string &data)
Set positional data and start to decode it.
bool skip_to(Xapian::termpos termpos)
Advance to the first term position which is at least termpos.
Xapian::termcount get_approx_size() const
Returns size of position list.
Xapian::termpos back() const
Return the final entry in this positionlist.
Xapian::termpos get_position() const
Returns current position.
bool next()
Advance to the next term position in the list.
HoneyPositionList(const HoneyPositionList &)=delete
Copying is not allowed.
static std::string make_key(Xapian::docid did, std::string_view term)
Xapian::termcount positionlist_count(Xapian::docid did, std::string_view term) const
Return the number of entries in specified position list.
void pack(std::string &s, const Xapian::VecCOW< Xapian::termpos > &vec) const
Pack a position list into a string.
void read_data(Xapian::docid did, const std::string &term)
Fill list with data, and move the position to the start.
void assign_data(std::string &&data)
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 honey 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.