26 #include <string_view>
71 return internal->get_docid();
77 return internal->get_data();
83 internal->set_data(data);
92 internal->add_term(
term, wdf_inc);
103 m =
"Document::remove_term() failed - term '";
105 m +=
"' not present";
118 internal->add_posting(
term, term_pos, wdf_inc);
129 auto res =
internal->remove_posting(
term, term_pos, wdf_dec);
131 string m =
"Document::remove_posting() failed - term '";
134 m +=
"' not present";
136 m +=
"' not present at position ";
152 if (
rare(term_pos_first > term_pos_last)) {
156 auto res =
internal->remove_postings(
term, term_pos_first, term_pos_last,
159 string m =
"Document::remove_postings() failed - term '";
161 m +=
"' not present";
170 internal->clear_terms();
175 return internal->termlist_count();
187 return internal->get_value(slot);
193 internal->add_value(slot, value);
199 internal->clear_values();
204 return internal->values_count();
210 return internal->values_begin();
228 return internal->get_description();
Abstract base class for a document.
bool remove_term(std::string_view term)
Remove a term from this document.
TermList * open_term_list() const
Start iterating the terms in this document.
Class representing a document.
Document & operator=(const Document &o)
Assignment operator.
Xapian::docid get_docid() const
Get the document ID this document came from.
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.
Xapian::Internal::intrusive_ptr_nonnull< Internal > internal
ValueIterator values_begin() const
Start iterating the values in this document.
std::string serialise() const
Serialise document into a string.
std::string get_value(Xapian::valueno slot) const
Read a value slot in this document.
void remove_term(std::string_view term)
Remove a term from this document.
void remove_posting(std::string_view term, Xapian::termpos term_pos, Xapian::termcount wdf_dec=1)
Remove posting for a term.
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.
void clear_values()
Clear all value slots in this document.
std::string get_description() const
Return a string describing this object.
void clear_terms()
Clear all terms from the document.
Xapian::termpos remove_postings(std::string_view term, Xapian::termpos term_pos_first, Xapian::termpos term_pos_last, Xapian::termcount wdf_dec=1)
Remove a range of postings for a term.
static Document unserialise(std::string_view serialised)
Unserialise a document from a string produced by serialise().
Document()
Default constructor.
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.
InvalidArgumentError indicates an invalid parameter value was passed to the API.
Class for iterating over a list of terms.
Class for iterating over document values.
static void throw_invalid_arg_empty_term()
Class representing a document.
Abstract base class for a document.
Hierarchy of classes which Xapian can throw as exceptions.
string str(int value)
Convert int to std::string.
The Xapian namespace contains public interfaces for the Xapian library.
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 docid
A unique identifier for a document.
unsigned XAPIAN_TERMPOS_BASE_TYPE termpos
A term position within a document or query.
string serialise_document(const Xapian::Document &doc)
Serialise a Xapian::Document object.
Xapian::Document unserialise_document(string_view s)
Unserialise a serialised Xapian::Document object.
functions to convert classes to strings and back
Convert types to std::string.