33 #include <string_view>
35 using namespace Honey;
42 if (!chunk_last)
return false;
45 const string& tag = cursor->current_tag;
46 reader.assign(tag.data(), tag.size(), chunk_last);
51 #define TOP_BIT_SET(T) ((static_cast<T>(-1) >> 1) + 1)
71 const char*
p = chunk.data();
72 const char* pend =
p + chunk.size();
82 chunk_last, first_wdf,
wdf_max))
90 }
else if (cf == tf - 1 + first_wdf) {
100 cf - first_wdf == remaining_cf_for_flat_wdf) {
128 if (!
cursor)
return false;
266 string desc =
"HoneyPostList(";
273 std::string_view term_,
276 position_list(db_->position_table) {}
291 string desc =
"HoneyPosPostList(";
303 const char* pend = p_ + len;
416 }
while (target >
did);
bool read_tag(bool keep_compressed=false)
bool find_entry_ge(std::string_view key)
Database using honey backend.
HoneyPositionTable position_table
PostList in a honey database with positions.
HoneyRePositionList position_list
PositionList object to reuse for OP_NEAR and OP_PHRASE.
std::string get_description() const
Return a string description of this object.
HoneyPosPostList(const HoneyDatabase *db_, std::string_view term_, HoneyCursor *cursor_)
PositionList * read_position_list()
Read the position list for the term in the current document and return a pointer to it (owned by the ...
HoneyPositionList * open_position_list(Xapian::docid did, std::string_view term) const
PostList in a honey database.
Xapian::termcount get_wdf() const
Return the wdf for the document at the current position.
Xapian::docid last_did
The highest document id in this posting list.
PositionList * open_position_list() const
Read the position list for the term in the current document and return a pointer to it (not owned by ...
Xapian::termcount wdf_max
Maximum wdf for this postlist.
bool open_nearby_postlist(std::string_view term_, bool need_read_pos, LeafPostList *&pl) const
Open another postlist from the same database.
HoneyCursor * cursor
Cursor on the postlist table.
Xapian::termcount get_wdf_upper_bound() const
const HoneyDatabase * db
HoneyDatabase to get position table object from.
void get_docid_range(Xapian::docid &first, Xapian::docid &last) const
Get the bounds on the range of docids this PostList can return.
PostList * skip_to(Xapian::docid did, double w_min)
Skip forward to the specified docid.
Honey::PostingChunkReader reader
bool update_reader()
Update reader to use the chunk currently pointed to by cursor.
HoneyPostList(const HoneyPostList &)=delete
Don't allow copying.
Xapian::docid get_docid() const
Return the current docid.
bool started
Needed so that first next() does nothing.
std::string get_description() const
Return a string description of this object.
bool at_end() const
Return true if the current position is past the last entry in this list.
void read_data(Xapian::docid did, const std::string &term)
Fill list with data, and move the position to the start.
Xapian::doccount termfreq
void init()
Initialise already at_end().
Xapian::docid get_docid() const
Xapian::docid last_did
The last docid in this chunk.
Xapian::termcount collfreq_info
Value "to do with" collection frequency.
void assign(const char *p_, size_t len, Xapian::docid did)
Xapian::termcount get_wdf() const
bool next()
Advance, returning false if we've run out of data.
bool skip_to(Xapian::docid target)
Skip ahead, returning false if we've run out of data.
Abstract base class for leaf postlists.
Xapian::termcount collfreq
The collection frequency of the term.
std::string term
The term name for this postlist (empty for an alldocs postlist).
DatabaseCorruptError indicates database corruption was detected.
Abstract base class for postlists.
PostList * next()
Advance the current position to the next document in the postlist.
Xapian::doccount termfreq
Estimate of the number of documents this PostList will return.
Abstract base class for iterating term positions in a document.
Database using honey backend.
A position list in a honey database.
PostList in a honey database.
Encoding and decoding functions for honey postlists.
bool decode_delta_chunk_header(const char **p, const char *end, Xapian::docid chunk_last, Xapian::docid &chunk_first, Xapian::termcount &chunk_first_wdf)
bool decode_initial_chunk_header(const char **p, const char *end, Xapian::doccount &termfreq, Xapian::termcount &collfreq, Xapian::docid &first, Xapian::docid &last, Xapian::docid &chunk_last, Xapian::termcount &first_wdf, Xapian::termcount &wdf_max)
bool decode_delta_chunk_header_no_wdf(const char **p, const char *end, Xapian::docid chunk_last, Xapian::docid &chunk_first)
std::string make_postingchunk_key(std::string_view term)
Generate a key for a posting initial chunk.
Xapian::docid docid_from_key(const std::string &key)
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.
#define AssertRel(A, REL, B)
Arithmetic operations with overflow checks.
std::enable_if_t< std::is_unsigned_v< T1 > &&std::is_unsigned_v< T2 > &&std::is_unsigned_v< R >, bool > mul_overflows(T1 a, T2 b, R &res)
Multiplication with overflow checking.
Pack types into strings and unpack them again.
bool unpack_uint_backwards(const char **p, const char *start, U *result)
Decode an unsigned integer from a string, going backwards.
bool unpack_uint(const char **p, const char *end, U *result)
Decode an unsigned integer from a string.