#include <document.h>
Collaboration diagram for Xapian::Document:
Public Member Functions | |
Document (const Document &other) | |
Copying is allowed. | |
void | operator= (const Document &other) |
Assignment is allowed. | |
Document () | |
Make a new empty Document. | |
~Document () | |
Destructor. | |
std::string | get_value (Xapian::valueno valueno) const |
Get value by number. | |
void | add_value (Xapian::valueno valueno, const std::string &value) |
Add a new value. | |
void | remove_value (Xapian::valueno valueno) |
Remove any value with the given number. | |
void | clear_values () |
Remove all values associated with the document. | |
std::string | get_data () const |
Get data stored in the document. | |
void | set_data (const std::string &data) |
Set data stored in the document. | |
void | add_posting (const std::string &tname, Xapian::termpos tpos, Xapian::termcount wdfinc=1) |
Add an occurrence of a term at a particular position. | |
void | add_term (const std::string &tname, Xapian::termcount wdfinc=1) |
Add a term to the document, without positional information. | |
void | remove_posting (const std::string &tname, Xapian::termpos tpos, Xapian::termcount wdfdec=1) |
Remove a posting of a term from the document. | |
void | remove_term (const std::string &tname) |
Remove a term and all postings associated with it. | |
void | clear_terms () |
Remove all terms (and postings) from the document. | |
Xapian::termcount | termlist_count () const |
The length of the termlist - i.e. | |
TermIterator | termlist_begin () const |
Iterator for the terms in this document. | |
TermIterator | termlist_end () const |
Equivalent end iterator for termlist_begin(). | |
Xapian::termcount | values_count () const |
Count the values in this document. | |
ValueIterator | values_begin () const |
Iterator for the values in this document. | |
ValueIterator | values_end () const |
Equivalent end iterator for values_begin(). | |
docid | get_docid () const |
Get the document id which is associated with this document (if any). | |
std::string | get_description () const |
Return a string describing this object. | |
Private Member Functions | |
Document (Internal *internal_) | |
For internal use only. Constructor is only used by internal classes. | |
Private Attributes | |
Xapian::Internal::RefCntPtr< Internal > | internal |
For internal use only. Reference counted internals. | |
Classes | |
class | Internal |
A document in the database, possibly plus modifications. More... |
Definition at line 39 of file document.h.
Xapian::Document::Document | ( | Internal * | internal_ | ) | [explicit, private] |
For internal use only.
Constructor is only used by internal classes.
internal_ | pointer to internal opaque class |
Definition at line 42 of file omdocument.cc.
Xapian::Document::Document | ( | const Document & | other | ) |
Copying is allowed.
The internals are reference counted, so copying is cheap.
Definition at line 78 of file omdocument.cc.
Xapian::Document::Document | ( | ) |
Xapian::Document::~Document | ( | ) |
void Xapian::Document::operator= | ( | const Document & | other | ) |
Assignment is allowed.
The internals are reference counted, so assignment is cheap.
Definition at line 72 of file omdocument.cc.
References internal.
string Xapian::Document::get_value | ( | Xapian::valueno | valueno | ) | const |
Get value by number.
Returns an empty string if no value with the given number is present in the document.
valueno | The number of the value. |
Definition at line 51 of file omdocument.cc.
References DEBUGAPICALL, internal, and RETURN.
Referenced by DEFINE_TESTCASE(), main(), and Xapian::MultiValueSorter::operator()().
void Xapian::Document::add_value | ( | Xapian::valueno | valueno, | |
const std::string & | value | |||
) |
Add a new value.
It will replace any existing value with the same number.
Referenced by bigoaddvalue_helper(), DEFINE_TESTCASE(), FileIndexer::next(), test_qp_value_range3(), test_serialisedoc1(), and unserialise_document().
void Xapian::Document::remove_value | ( | Xapian::valueno | valueno | ) |
Remove any value with the given number.
Definition at line 101 of file omdocument.cc.
References DEBUGAPICALL.
Referenced by DEFINE_TESTCASE().
void Xapian::Document::clear_values | ( | ) |
Remove all values associated with the document.
Definition at line 108 of file omdocument.cc.
References DEBUGAPICALL.
string Xapian::Document::get_data | ( | ) | const |
Get data stored in the document.
This is a potentially expensive operation, and shouldn't normally be used in a match decider functor. Put data for use by match deciders in a value instead.
Definition at line 58 of file omdocument.cc.
References DEBUGAPICALL, internal, and RETURN.
Referenced by InMemoryDatabase::add_document(), QuartzWritableDatabase::add_document_(), FlintWritableDatabase::add_document_(), DEFINE_TESTCASE(), myMatchDecider2::operator()(), myMatchDecider::operator()(), QuartzWritableDatabase::replace_document(), InMemoryDatabase::replace_document(), FlintWritableDatabase::replace_document(), serialise_document(), and show_docdata().
void Xapian::Document::set_data | ( | const std::string & | data | ) |
Set data stored in the document.
Referenced by DEFINE_TESTCASE(), FileIndexer::next(), test_serialisedoc1(), and unserialise_document().
void Xapian::Document::add_posting | ( | const std::string & | tname, | |
Xapian::termpos | tpos, | |||
Xapian::termcount | wdfinc = 1 | |||
) |
Add an occurrence of a term at a particular position.
Multiple occurrences of the term at the same position are represented only once in the positional information, but do increase the wdf.
If the term is not already in the document, it will be added to it.
tname | The name of the term. | |
tpos | The position of the term. | |
wdfinc | The increment that will be applied to the wdf for this term. |
Referenced by DEFINE_TESTCASE(), FileIndexer::next(), and unserialise_document().
void Xapian::Document::add_term | ( | const std::string & | tname, | |
Xapian::termcount | wdfinc = 1 | |||
) |
Add a term to the document, without positional information.
Any existing positional information for the term will be left unmodified.
tname | The name of the term. | |
wdfinc | The increment that will be applied to the wdf for this term. |
Referenced by DEFINE_TESTCASE(), test_qp_flag_partial1(), test_qp_flag_wildcard1(), test_qp_flag_wildcard2(), test_serialisedoc1(), and unserialise_document().
void Xapian::Document::remove_posting | ( | const std::string & | tname, | |
Xapian::termpos | tpos, | |||
Xapian::termcount | wdfdec = 1 | |||
) |
Remove a posting of a term from the document.
Note that the term will still index the document even if all occurrences are removed. To remove a term from a document completely, use remove_term().
tname | The name of the term. | |
tpos | The position of the term. | |
wdfdec | The decrement that will be applied to the wdf when removing this posting. The wdf will not go below the value of 0. |
Xapian::InvalidArgumentError | will be thrown if the term is not at the position specified in the position list for this term in this document. | |
Xapian::InvalidArgumentError | will be thrown if the term is not in the document |
Referenced by DEFINE_TESTCASE().
void Xapian::Document::remove_term | ( | const std::string & | tname | ) |
Remove a term and all postings associated with it.
tname | The name of the term. |
Xapian::InvalidArgumentError | will be thrown if the term is not in the document |
Referenced by DEFINE_TESTCASE().
void Xapian::Document::clear_terms | ( | ) |
Remove all terms (and postings) from the document.
Definition at line 157 of file omdocument.cc.
References DEBUGAPICALL.
Xapian::termcount Xapian::Document::termlist_count | ( | ) | const |
The length of the termlist - i.e.
the number of different terms which index this document.
Definition at line 164 of file omdocument.cc.
References DEBUGAPICALL, internal, and RETURN.
Referenced by serialise_document(), and FlintTermListTable::set_termlist().
TermIterator Xapian::Document::termlist_begin | ( | ) | const |
Iterator for the terms in this document.
Definition at line 170 of file omdocument.cc.
References DEBUGAPICALL, internal, and RETURN.
Referenced by QuartzWritableDatabase::add_document_(), FlintWritableDatabase::add_document_(), DEFINE_TESTCASE(), InMemoryDatabase::finish_add_doc(), format_doc_termlist(), QuartzWritableDatabase::replace_document(), FlintWritableDatabase::replace_document(), serialise_document(), and FlintTermListTable::set_termlist().
TermIterator Xapian::Document::termlist_end | ( | ) | const [inline] |
Equivalent end iterator for termlist_begin().
Definition at line 170 of file document.h.
Referenced by QuartzWritableDatabase::add_document_(), FlintWritableDatabase::add_document_(), DEFINE_TESTCASE(), InMemoryDatabase::finish_add_doc(), format_doc_termlist(), QuartzWritableDatabase::replace_document(), FlintWritableDatabase::replace_document(), serialise_document(), and FlintTermListTable::set_termlist().
Xapian::termcount Xapian::Document::values_count | ( | ) | const |
Count the values in this document.
Definition at line 177 of file omdocument.cc.
References DEBUGAPICALL, internal, and RETURN.
Referenced by serialise_document().
ValueIterator Xapian::Document::values_begin | ( | ) | const |
Iterator for the values in this document.
Definition at line 183 of file omdocument.cc.
References DEBUGAPICALL, and RETURN.
Referenced by QuartzWritableDatabase::add_document_(), FlintWritableDatabase::add_document_(), DEFINE_TESTCASE(), InMemoryDatabase::finish_add_doc(), QuartzWritableDatabase::replace_document(), FlintWritableDatabase::replace_document(), serialise_document(), and show_values().
ValueIterator Xapian::Document::values_end | ( | ) | const |
Equivalent end iterator for values_begin().
Definition at line 192 of file omdocument.cc.
References DEBUGAPICALL, internal, and RETURN.
Referenced by QuartzWritableDatabase::add_document_(), FlintWritableDatabase::add_document_(), DEFINE_TESTCASE(), InMemoryDatabase::finish_add_doc(), QuartzWritableDatabase::replace_document(), FlintWritableDatabase::replace_document(), serialise_document(), and show_values().
docid Xapian::Document::get_docid | ( | ) | const |
Get the document id which is associated with this document (if any).
NB If multiple databases are being searched together, then this will be the document id in the individual database, not the merged database!
Definition at line 199 of file omdocument.cc.
References DEBUGAPICALL, internal, and RETURN.
string Xapian::Document::get_description | ( | ) | const |
For internal use only.
Reference counted internals.
Definition at line 41 of file document.h.
Referenced by get_data(), get_docid(), get_value(), Xapian::ValueIterator::get_valueno(), Xapian::ValueIterator::operator *(), Xapian::ValueIterator::operator->(), operator=(), termlist_begin(), termlist_count(), values_count(), and values_end().