Xapian::Document Class Reference

A document in the database - holds data, values, terms, and postings. More...

#include <document.h>

Collaboration diagram for Xapian::Document:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Document (Internal *internal_)
 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 value) const
 Get value by number (>= 0).
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.
 XAPIAN_DEPRECATED (void add_term_nopos(const std::string &term, Xapian::termcount wdfinc=1))
 Old name for add_term().
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
 Count the terms in this document.
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().
std::string get_description () const
 Introspection method.

Public Attributes

Xapian::Internal::RefCntPtr<
Internal > 
internal

Detailed Description

A document in the database - holds data, values, terms, and postings.


Constructor & Destructor Documentation

Xapian::Document::Document const Document other  ) 
 

Copying is allowed.

The internals are reference counted, so copying is cheap.

Xapian::Document::Document  ) 
 

Make a new empty Document.

Xapian::Document::~Document  ) 
 

Destructor.


Member Function Documentation

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.

Parameters:
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.

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.

Parameters:
tname The name of the term.
wdfinc The increment that will be applied to the wdf for this term.

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.

void Xapian::Document::clear_terms  ) 
 

Remove all terms (and postings) from the document.

void Xapian::Document::clear_values  ) 
 

Remove all values associated with the document.

std::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.

std::string Xapian::Document::get_description  )  const
 

Introspection method.

Returns:
A string representing this Document.

std::string Xapian::Document::get_value Xapian::valueno  value  )  const
 

Get value by number (>= 0).

void Xapian::Document::operator= const Document other  ) 
 

Assignment is allowed.

The internals are reference counted, so assignment is cheap.

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().

Parameters:
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.
Exceptions:
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

void Xapian::Document::remove_term const std::string &  tname  ) 
 

Remove a term and all postings associated with it.

Parameters:
tname The name of the term.
Exceptions:
Xapian::InvalidArgumentError will be thrown if the term is not in the document

void Xapian::Document::remove_value Xapian::valueno  valueno  ) 
 

Remove any value with the given number.

void Xapian::Document::set_data const std::string &  data  ) 
 

Set data stored in the document.

TermIterator Xapian::Document::termlist_begin  )  const
 

Iterator for the terms in this document.

Xapian::termcount Xapian::Document::termlist_count  )  const
 

Count the terms in this document.

TermIterator Xapian::Document::termlist_end  )  const [inline]
 

Equivalent end iterator for termlist_begin().

ValueIterator Xapian::Document::values_begin  )  const
 

Iterator for the values in this document.

Xapian::termcount Xapian::Document::values_count  )  const
 

Count the values in this document.

ValueIterator Xapian::Document::values_end  )  const
 

Equivalent end iterator for values_begin().

Xapian::Document::XAPIAN_DEPRECATED void   add_term_nopos(const std::string &term, Xapian::termcount wdfinc=1)  ) 
 

Old name for add_term().

Deprecated:
This method is deprecated and present only for backward compatibility. Use add_term() instead.


The documentation for this class was generated from the following file:
Documentation for Xapian (version 0.9.6).
Generated on 15 May 2006 by Doxygen 1.4.6.