22 #ifndef XAPIAN_INCLUDED_HONEY_VALUES_H
23 #define XAPIAN_INCLUDED_HONEY_VALUES_H
41 std::string key(1,
'\0');
55 const char*
p = key.data();
56 const char* end =
p + key.length();
57 if (end -
p < 3 || *
p++ !=
'\0') {
61 unsigned char code = *
p++;
75 if (slot != required_slot)
return 0;
85 std::string key(1,
'\0');
95 inline static std::string
97 const std::string& lbound,
98 const std::string& ubound)
106 if (lbound != ubound) value += ubound;
135 std::map<Xapian::docid, std::string>
slots;
137 std::map<Xapian::valueno, std::map<Xapian::docid, std::string>>
changes;
139 mutable std::unique_ptr<HoneyCursor>
cursor;
142 const std::string& val);
152 std::string& chunk)
const;
170 std::map<Xapian::valueno, ValueStats>& val_stats);
173 std::map<Xapian::valueno, ValueStats>& val_stats);
177 std::map<Xapian::valueno, ValueStats>& val_stats);
181 void get_all_values(std::map<Xapian::valueno, std::string>& values,
206 void set_value_stats(std::map<Xapian::valueno, ValueStats>& val_stats);
239 assign(p_, len, last_did);
ValueStats mru_valstats
The most recently used value statistics.
void add_value(Xapian::docid did, Xapian::valueno slot, const std::string &val)
std::string get_value_upper_bound(Xapian::valueno slot) const
std::map< Xapian::valueno, std::map< Xapian::docid, std::string > > changes
std::unique_ptr< HoneyCursor > cursor
HoneyTermListTable & termlist_table
void get_all_values(std::map< Xapian::valueno, std::string > &values, Xapian::docid did) const
std::string get_value_lower_bound(Xapian::valueno slot) const
std::string get_value(Xapian::docid did, Xapian::valueno slot) const
void remove_value(Xapian::docid did, Xapian::valueno slot)
void set_value_stats(std::map< Xapian::valueno, ValueStats > &val_stats)
Write the updated statistics to the table.
std::string add_document(Xapian::docid did, const Xapian::Document &doc, std::map< Xapian::valueno, ValueStats > &val_stats)
void get_value_stats(Xapian::valueno slot) const
Get the statistics for value slot slot.
Xapian::valueno mru_slot
The value number for the most recently used value statistics.
void delete_document(Xapian::docid did, std::map< Xapian::valueno, ValueStats > &val_stats)
std::map< Xapian::docid, std::string > slots
HoneyPostListTable & postlist_table
std::string replace_document(Xapian::docid did, const Xapian::Document &doc, std::map< Xapian::valueno, ValueStats > &val_stats)
Xapian::docid get_chunk_containing_did(Xapian::valueno slot, Xapian::docid did, std::string &chunk) const
Move the cursor to the chunk containing did.
Xapian::doccount get_value_freq(Xapian::valueno slot) const
HoneyValueManager(HoneyPostListTable &postlist_table_, HoneyTermListTable &termlist_table_)
Create a new HoneyValueManager object.
void assign(const char *p_, size_t len, Xapian::docid last_did)
ValueChunkReader()
Create a ValueChunkReader which is already at_end().
const std::string & get_value() const
ValueChunkReader(const char *p_, size_t len, Xapian::docid last_did)
void skip_to(Xapian::docid target)
Xapian::docid get_docid() const
DatabaseCorruptError indicates database corruption was detected.
Class representing a document.
Hierarchy of classes which Xapian can throw as exceptions.
static std::string encode_valuestats(Xapian::doccount freq, const std::string &lbound, const std::string &ubound)
std::string make_valuechunk_key(Xapian::valueno slot, Xapian::docid last_did)
Generate a key for a value stream chunk.
Xapian::docid docid_from_key(const std::string &key)
std::string make_valuestats_key(Xapian::valueno slot)
The Xapian namespace contains public interfaces for the Xapian library.
const valueno BAD_VALUENO
Reserved value to indicate "no valueno".
unsigned valueno
The number for a value slot in a document.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Pack types into strings and unpack them again.
void pack_uint(std::string &s, U value)
Append an encoded unsigned integer to a string.
void pack_string(std::string &s, std::string_view value)
Append an encoded std::string to a string.
bool unpack_uint_preserving_sort(const char **p, const char *end, U *result)
Decode a "sort preserved" unsigned integer from a string.
void pack_uint_preserving_sort(std::string &s, U value)
Append an encoded unsigned integer to a string, preserving the sort order.
Class to hold statistics for a given slot.
std::string lower_bound
A lower bound on the values stored in the given value slot.
std::string upper_bound
An upper bound on the values stored in the given value slot.
Xapian::doccount freq
The number of documents which have a (non-empty) value stored in the slot.