37 #include <string_view>
58 string_view prev_term;
60 const string&
term = i.first;
66 size_t append =
term.size() - reuse;
67 if (reuse == prev_term.size() &&
usual(
term.size() <= 255)) {
73 result += char(
term.size());
75 result += char(reuse);
78 result.append(
term.data() + reuse, append);
118 size_t reuse =
static_cast<unsigned char>(*
p++);
120 if (reuse <=
term.size()) {
123 size_t(p_end -
p) < append) {
127 append = reuse -
term.size();
129 term.append(
p, append);
136 double max_part = 0.0;
166 const char *
p = s.data();
167 const char * p_end =
p + s.size();
204 size_t x =
term.positionlist_count();
226 const char *
p = s.data();
227 const char * p_end =
p + s.size();
234 for ( ; n_values; --n_values) {
248 for ( ; n_terms; --n_terms) {
262 for ( ; n_pos; --n_pos) {
Class representing a document.
void set_data(std::string_view data)
Set the document data.
std::string get_data() const
Get the document data.
void add_term(std::string_view term, Xapian::termcount wdf_inc=1)
Add a term to this document.
Xapian::valueno values_count() const
Count the value slots used in this document.
ValueIterator values_begin() const
Start iterating the values in this document.
TermIterator termlist_end() const noexcept
End iterator corresponding to termlist_begin().
Xapian::termcount termlist_count() const
Return the number of distinct terms in this document.
TermIterator termlist_begin() const
Start iterating the terms in this document.
ValueIterator values_end() const noexcept
End iterator corresponding to values_begin().
void add_value(Xapian::valueno slot, std::string_view value)
Add a value to a slot in this document.
void add_posting(std::string_view term, Xapian::termpos term_pos, Xapian::termcount wdf_inc=1)
Add a posting for a term.
Class for iterating over term positions.
Class representing a set of documents judged as relevant.
Xapian::Internal::intrusive_ptr< Internal > internal
void add_document(Xapian::docid did)
Mark a document as relevant.
Class for iterating over a list of terms.
Class for iterating over document values.
Xapian::valueno get_valueno() const
Return the value slot number for the current position.
Class to hold statistics for a given collection.
Xapian::totallength total_length
Total length of all documents in the collection.
Xapian::termcount db_doclength_upper_bound
An upper bound on the maximum length of any document in the database.
bool have_max_part
Has max_part been set for any term?
Xapian::termcount db_doclength_lower_bound
A lower bound on the minimum length of any document in the database.
Xapian::termcount db_unique_terms_lower_bound
A lower bound on the number of unique terms in any document.
Xapian::doccount rset_size
Number of relevant documents in the collection.
Xapian::doccount collection_size
Number of documents in the collection.
std::map< std::string, TermFreqs, std::less<> > termfreqs
Map of term frequencies and relevant term frequencies for the collection.
Xapian::termcount db_unique_terms_upper_bound
An upper bound on the number of unique terms in any document.
Class representing a document.
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
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.
unsigned XAPIAN_TERMPOS_BASE_TYPE termpos
A term position within a document or query.
Various assertion macros.
#define AssertRel(A, REL, B)
void unpack_throw_serialisation_error(const char *p)
Throw appropriate SerialisationError.
Pack types into strings and unpack them again.
bool unpack_string(const char **p, const char *end, std::string &result)
Decode a std::string from a string.
bool unpack_bool(const char **p, const char *end, bool *result)
Decode a bool from a string.
void pack_bool(std::string &s, bool value)
Append an encoded bool to a string.
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.
void pack_string(std::string &s, std::string_view value)
Append an encoded std::string to a string.
Class for iterating over term positions.
Set of documents judged as relevant.
string serialise_double(double v)
Serialise a double to a string.
double unserialise_double(const char **p, const char *end)
Unserialise a double serialised by serialise_double.
functions to serialise and unserialise a double
string serialise_document(const Xapian::Document &doc)
Serialise a Xapian::Document object.
string serialise_stats(const Xapian::Weight::Internal &stats)
Serialise a stats object.
Xapian::Document unserialise_document(string_view s)
Unserialise a serialised Xapian::Document object.
Xapian::RSet unserialise_rset(const string &s)
Unserialise a serialised Xapian::RSet object.
void unserialise_stats(const char *p, const char *p_end, Xapian::Weight::Internal &stat)
Unserialise a serialised stats object.
string serialise_rset(const Xapian::RSet &rset)
Serialise a Xapian::RSet object.
functions to convert classes to strings and back
Various handy string-related helpers.
std::string::size_type common_prefix_length(std::string_view a, std::string_view b)
The frequencies for a term.
Class for iterating over a list of terms.
Class for iterating over document values.
Xapian::Weight::Internal class, holding database and term statistics.