22 #ifndef XAPIAN_INCLUDED_CHERT_VALUES_H 23 #define XAPIAN_INCLUDED_CHERT_VALUES_H 41 std::string key(
"\0\xd8", 2);
50 const char * p = key.data();
51 const char * end = p + key.length();
53 if (end - p < 2 || *p++ !=
'\0' || *p++ !=
'\xd8')
return 0;
58 if (slot != required_slot)
return 0;
88 std::map<Xapian::docid, std::string>
slots;
90 std::map<Xapian::valueno, std::map<Xapian::docid, std::string>>
changes;
95 const std::string & val);
101 std::string &chunk)
const;
113 postlist_table(postlist_table_),
114 termlist_table(termlist_table_) { }
117 void merge_changes();
120 std::map<Xapian::valueno, ValueStats> & value_stats);
123 std::map<Xapian::valueno, ValueStats> & value_stats);
126 std::map<Xapian::valueno, ValueStats> & value_stats);
130 void get_all_values(std::map<Xapian::valueno, std::string> & values,
134 if (mru_slot != slot) get_value_stats(slot);
135 return mru_valstats.
freq;
139 if (mru_slot != slot) get_value_stats(slot);
144 if (mru_slot != slot) get_value_stats(slot);
155 void set_value_stats(std::map<Xapian::valueno, ValueStats> & value_stats);
163 return !changes.empty();
186 assign(p_, len, did_);
189 void assign(
const char * p_,
size_t len,
Xapian::docid did_);
191 bool at_end()
const {
return p == NULL; }
202 #endif // XAPIAN_INCLUDED_CHERT_VALUES_H std::map< Xapian::docid, std::string > slots
The Xapian namespace contains public interfaces for the Xapian library.
ChertPostListTable * postlist_table
Class to hold statistics for a given slot.
A cursor pointing to a position in a Btree table, for reading several entries in order, or finding approximate matches.
ValueChunkReader()
Create a ValueChunkReader which is already at_end().
std::string get_value_upper_bound(Xapian::valueno slot) const
AutoPtr< ChertCursor > cursor
std::string make_valuechunk_key(Xapian::valueno slot, Xapian::docid did)
Generate a key for a value stream chunk.
Xapian::doccount get_value_freq(Xapian::valueno slot) const
std::string upper_bound
An upper bound on the values stored in the given value slot.
ValueStats mru_valstats
The most recently used value statistics.
Xapian::doccount freq
The number of documents which have a (non-empty) value stored in the slot.
std::string lower_bound
A lower bound on the values stored in the given value slot.
Hierarchy of classes which Xapian can throw as exceptions.
const std::string & get_value() const
ChertValueManager(ChertPostListTable *postlist_table_, ChertTermListTable *termlist_table_)
Create a new ChertValueManager object.
void C_pack_uint_preserving_sort(std::string &s, U value)
Append an encoded unsigned integer to a string, preserving the sort order.
bool C_unpack_uint_preserving_sort(const char **p, const char *end, U *result)
Decode an "sort preserved" unsigned integer from a string.
ChertTermListTable * termlist_table
Xapian::docid docid_from_key(Xapian::valueno required_slot, const std::string &key)
DatabaseCorruptError indicates database corruption was detected.
std::map< Xapian::valueno, std::map< Xapian::docid, std::string > > changes
void pack_uint(std::string &s, U value)
Append an encoded unsigned integer to a string.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Pack types into strings and unpack them again.
unsigned valueno
The number for a value slot in a document.
bool unpack_uint(const char **p, const char *end, U *result)
Decode an unsigned integer from a string.
ValueChunkReader(const char *p_, size_t len, Xapian::docid did_)
std::string get_value_lower_bound(Xapian::valueno slot) const
Xapian::valueno mru_slot
The value number for the most recently used value statistics.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Xapian::docid get_docid() const
const valueno BAD_VALUENO
Reserved value to indicate "no valueno".
A handle representing a document in a Xapian database.
Wrapper around standard unique_ptr template.