22 #ifndef XAPIAN_INCLUDED_GLASS_VALUES_H 23 #define XAPIAN_INCLUDED_GLASS_VALUES_H 43 std::string key(
"\0\xd8", 2);
52 const char * p = key.data();
53 const char * end = p + key.length();
55 if (end - p < 2 || *p++ !=
'\0' || *p++ !=
'\xd8')
return 0;
60 if (slot != required_slot)
return 0;
92 std::map<Xapian::docid, std::string>
slots;
94 std::map<Xapian::valueno, std::map<Xapian::docid, std::string>>
changes;
99 const std::string & val);
105 std::string &chunk)
const;
117 postlist_table(postlist_table_),
118 termlist_table(termlist_table_) { }
121 void merge_changes();
124 std::map<Xapian::valueno, ValueStats> & value_stats);
127 std::map<Xapian::valueno, ValueStats> & value_stats);
130 std::map<Xapian::valueno, ValueStats> & value_stats);
134 void get_all_values(std::map<Xapian::valueno, std::string> & values,
138 if (mru_slot != slot) get_value_stats(slot);
139 return mru_valstats.
freq;
143 if (mru_slot != slot) get_value_stats(slot);
148 if (mru_slot != slot) get_value_stats(slot);
159 void set_value_stats(std::map<Xapian::valueno, ValueStats> & value_stats);
167 return !changes.empty();
193 assign(p_, len, did_);
196 void assign(
const char * p_,
size_t len,
Xapian::docid did_);
198 bool at_end()
const {
return p == NULL; }
211 #endif // XAPIAN_INCLUDED_GLASS_VALUES_H The Xapian namespace contains public interfaces for the Xapian library.
Class to hold statistics for a given slot.
GlassTermListTable * termlist_table
GlassPostListTable * postlist_table
ValueChunkReader(const char *p_, size_t len, Xapian::docid did_)
Xapian::docid docid_from_key(Xapian::valueno required_slot, const std::string &key)
std::string make_valuechunk_key(Xapian::valueno slot, Xapian::docid did)
Generate a key for a value stream chunk.
ValueStats mru_valstats
The most recently used value statistics.
std::string upper_bound
An upper bound on the values stored in the given value slot.
GlassValueManager(GlassPostListTable *postlist_table_, GlassTermListTable *termlist_table_)
Create a new GlassValueManager object.
Xapian::doccount freq
The number of documents which have a (non-empty) value stored in the slot.
const std::string & get_value() const
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.
std::map< Xapian::docid, std::string > slots
Xapian::valueno mru_slot
The value number for the most recently used value statistics.
bool unpack_uint_preserving_sort(const char **p, const char *end, U *result)
Decode a "sort preserved" unsigned integer from a string.
DatabaseCorruptError indicates database corruption was detected.
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.
Interface to Btree cursors.
Xapian::docid get_docid() const
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.
Xapian::doccount get_value_freq(Xapian::valueno slot) const
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
ValueChunkReader()
Create a ValueChunkReader which is already at_end().
const valueno BAD_VALUENO
Reserved value to indicate "no valueno".
std::map< Xapian::valueno, std::map< Xapian::docid, std::string > > changes
std::string get_value_upper_bound(Xapian::valueno slot) const
AutoPtr< GlassCursor > cursor
A handle representing a document in a Xapian database.
std::string get_value_lower_bound(Xapian::valueno slot) const
Wrapper around standard unique_ptr template.
void pack_uint_preserving_sort(std::string &s, U value)
Append an encoded unsigned integer to a string, preserving the sort order.