Xapian::Document::Internal Class Reference

A document in the database, possibly plus modifications. More...

#include <document.h>

Inheritance diagram for Xapian::Document::Internal:

Inheritance graph
[legend]
Collaboration diagram for Xapian::Document::Internal:

Collaboration graph
[legend]

List of all members.

Public Types

typedef map< Xapian::valueno,
string > 
document_values
 Type to store values in.
typedef map< string,
OmDocumentTerm
document_terms
 Type to store terms in.

Public Member Functions

string get_value (Xapian::valueno slot) const
 Get value by value number.
void set_all_values (map< Xapian::valueno, string > &values_)
 Set all the values.
Xapian::valueno values_count () const
void add_value (Xapian::valueno, const string &)
void remove_value (Xapian::valueno)
void clear_values ()
void add_posting (const string &, Xapian::termpos, Xapian::termcount)
void add_term (const string &, Xapian::termcount)
void remove_posting (const string &, Xapian::termpos, Xapian::termcount)
void remove_term (const string &)
void clear_terms ()
Xapian::termcount termlist_count () const
string get_data () const
 Get data stored in document.
void set_data (const string &)
TermListopen_term_list () const
 Open a term list.
void need_values () const
void need_terms () const
bool data_modified () const
 Return true if the data in the document may have been modified.
bool values_modified () const
 Return true if the values in the document may have been modified.
bool terms_modified () const
 Return true if the terms in the document may have been modified.
bool term_positions_modified () const
 Return true if term positions may have been modified.
bool modified () const
 Return true if the document may have been modified.
Xapian::docid get_docid () const
 Get the docid which is associated with this document (if any).
string get_description () const
 Return a string describing this object.
 Internal (Xapian::Internal::RefCntPtr< const Xapian::Database::Internal > database_, Xapian::docid did_)
 Constructor.
 Internal ()
virtual ~Internal ()
 Destructor.

Protected Attributes

Xapian::Internal::RefCntPtr
< const
Xapian::Database::Internal
database
 The database this document is in.
Xapian::docid did
 The document ID of the document in that database.

Private Member Functions

 Internal (const Internal &)
Internaloperator= (const Internal &)
virtual string do_get_value (Xapian::valueno) const
virtual void do_get_all_values (map< Xapian::valueno, string > &values_) const
virtual string do_get_data () const

Private Attributes

bool data_here
bool values_here
bool terms_here
bool positions_modified
string data
 The (user defined) data associated with this document.
document_values values
 The values associated with this document.
document_terms terms
 The terms (and their frequencies and positions) in this document.

Friends

class ::DocumentValueList
class ::ValueStreamDocument


Detailed Description

A document in the database, possibly plus modifications.

Definition at line 40 of file document.h.


Member Typedef Documentation

Type to store terms in.

Definition at line 48 of file document.h.

Type to store values in.

Definition at line 45 of file document.h.


Constructor & Destructor Documentation

Xapian::Document::Internal::Internal ( const Internal  )  [private]

Xapian::Document::Internal::Internal ( Xapian::Internal::RefCntPtr< const Xapian::Database::Internal database_,
Xapian::docid  did_ 
) [inline]

Constructor.

In derived classes, this will typically be a private method, and only be called by database objects of the corresponding type.

Definition at line 207 of file document.h.

Xapian::Document::Internal::Internal (  )  [inline]

Definition at line 212 of file document.h.

Xapian::Document::Internal::~Internal (  )  [virtual]

Destructor.

Note that the database object which created this document must still exist at the time this is called.

Definition at line 503 of file omdocument.cc.

References database, and Xapian::Internal::RefCntPtr< T >::get().


Member Function Documentation

void Xapian::Document::Internal::add_posting ( const string &  tname,
Xapian::termpos  tpos,
Xapian::termcount  wdfinc 
)

Definition at line 345 of file omdocument.cc.

References OmDocumentTerm::add_position(), need_terms(), positions_modified, and terms.

void Xapian::Document::Internal::add_term ( const string &  tname,
Xapian::termcount  wdfinc 
)

Definition at line 364 of file omdocument.cc.

References need_terms(), and terms.

void Xapian::Document::Internal::add_value ( Xapian::valueno  slot,
const string &  value 
)

Definition at line 312 of file omdocument.cc.

References need_values(), and values.

void Xapian::Document::Internal::clear_terms (  ) 

Definition at line 413 of file omdocument.cc.

References positions_modified, terms, and terms_here.

void Xapian::Document::Internal::clear_values (  ) 

Definition at line 338 of file omdocument.cc.

References values, and values_here.

bool Xapian::Document::Internal::data_modified (  )  const [inline]

Return true if the data in the document may have been modified.

Definition at line 162 of file document.h.

References data_here.

virtual void Xapian::Document::Internal::do_get_all_values ( map< Xapian::valueno, string > &  values_  )  const [inline, private, virtual]

Reimplemented in BrassDocument, and ChertDocument.

Definition at line 84 of file document.h.

Referenced by need_values().

virtual string Xapian::Document::Internal::do_get_data (  )  const [inline, private, virtual]

virtual string Xapian::Document::Internal::do_get_value ( Xapian::valueno   )  const [inline, private, virtual]

Reimplemented in BrassDocument, ChertDocument, FlintDocument, InMemoryDocument, RemoteDocument, and ValueStreamDocument.

Definition at line 83 of file document.h.

Referenced by get_value().

string Xapian::Document::Internal::get_data (  )  const

Get data stored in document.

This is a general piece of data associated with a document, and will typically be used to store such information as text to be displayed in the result list, and a pointer in some form (eg, URL) to the full text of the document.

This operation can be expensive, and shouldn't normally be used during the match operation (such as in a match decider functor): use a value instead, if at all possible.

Returns:
An string containing the data for this document.

Definition at line 286 of file omdocument.cc.

References data, data_here, database, do_get_data(), and Xapian::Internal::RefCntPtr< T >::get().

string Xapian::Document::Internal::get_description (  )  const

Return a string describing this object.

Definition at line 464 of file omdocument.cc.

References data, data_here, database, Xapian::Internal::RefCntPtr< T >::get(), Xapian::Internal::str(), terms, terms_here, values, and values_here.

Xapian::docid Xapian::Document::Internal::get_docid (  )  const [inline]

Get the docid 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!

Returns:
If this document came from a database, return the document id in that database. Otherwise, return 0.

Definition at line 197 of file document.h.

References did.

string Xapian::Document::Internal::get_value ( Xapian::valueno  slot  )  const

Get value by value number.

Values are quickly accessible fields, for use during the match operation. Each document may have a set of values, each of which having a different value number. Duplicate values with the same value number are not supported in a single document.

Value numbers are any integer >= 0, but particular database backends may impose a more restrictive range than that.

Parameters:
slot The value number requested.
Returns:
A string containing the specified value. If the value is not present in this document, the value's value will be a zero length string

Reimplemented in ValueStreamDocument.

Definition at line 273 of file omdocument.cc.

References database, do_get_value(), Xapian::Internal::RefCntPtr< T >::get(), values, and values_here.

Referenced by ValueStreamDocument::do_get_value(), and Collapser::process().

bool Xapian::Document::Internal::modified (  )  const [inline]

Return true if the document may have been modified.

Definition at line 184 of file document.h.

References data_here, terms_here, and values_here.

void Xapian::Document::Internal::need_terms (  )  const

void Xapian::Document::Internal::need_values (  )  const

TermList * Xapian::Document::Internal::open_term_list (  )  const

Open a term list.

This is a list of all the terms contained by a given document.

Returns:
A pointer to the newly created term list. This object must be deleted by the caller after use.

Definition at line 301 of file omdocument.cc.

References database, did, Xapian::Internal::RefCntPtr< T >::get(), LOGCALL, RETURN, terms, and terms_here.

Internal& Xapian::Document::Internal::operator= ( const Internal  )  [private]

void Xapian::Document::Internal::remove_posting ( const string &  tname,
Xapian::termpos  tpos,
Xapian::termcount  wdfdec 
)

Definition at line 379 of file omdocument.cc.

References need_terms(), positions_modified, and terms.

void Xapian::Document::Internal::remove_term ( const string &  tname  ) 

Definition at line 398 of file omdocument.cc.

References need_terms(), positions_modified, and terms.

void Xapian::Document::Internal::remove_value ( Xapian::valueno  slot  ) 

Definition at line 325 of file omdocument.cc.

References need_values(), Xapian::Internal::str(), and values.

void Xapian::Document::Internal::set_all_values ( map< Xapian::valueno, string > &  values_  )  [inline]

Set all the values.

Parameters:
values_ The values to set - passed by non-const reference, and may be modified by the call.

Definition at line 113 of file document.h.

References values, and values_here.

Referenced by RemoteDocument::RemoteDocument().

void Xapian::Document::Internal::set_data ( const string &  data_  ) 

Definition at line 294 of file omdocument.cc.

References data, and data_here.

Referenced by RemoteDocument::RemoteDocument().

bool Xapian::Document::Internal::term_positions_modified (  )  const [inline]

Return true if term positions may have been modified.

Definition at line 179 of file document.h.

References positions_modified.

Xapian::termcount Xapian::Document::Internal::termlist_count (  )  const

Definition at line 423 of file omdocument.cc.

References Assert, need_terms(), terms, and terms_here.

bool Xapian::Document::Internal::terms_modified (  )  const [inline]

Return true if the terms in the document may have been modified.

Definition at line 174 of file document.h.

References terms_here.

Xapian::valueno Xapian::Document::Internal::values_count (  )  const

Definition at line 455 of file omdocument.cc.

References Assert, LOGCALL, need_values(), RETURN, values, and values_here.

bool Xapian::Document::Internal::values_modified (  )  const [inline]

Return true if the values in the document may have been modified.

Definition at line 168 of file document.h.

References values_here.


Friends And Related Function Documentation

friend class ::DocumentValueList [friend]

Definition at line 41 of file document.h.

friend class ::ValueStreamDocument [friend]

Definition at line 42 of file document.h.


Member Data Documentation

The (user defined) data associated with this document.

Definition at line 65 of file document.h.

Referenced by get_data(), get_description(), and set_data().

Definition at line 59 of file document.h.

Referenced by data_modified(), get_data(), get_description(), modified(), and set_data().

The terms (and their frequencies and positions) in this document.

Definition at line 71 of file document.h.

Referenced by add_posting(), add_term(), clear_terms(), get_description(), need_terms(), open_term_list(), remove_posting(), remove_term(), and termlist_count().

bool Xapian::Document::Internal::terms_here [mutable, private]

The values associated with this document.

Definition at line 68 of file document.h.

Referenced by add_value(), clear_values(), get_description(), get_value(), need_values(), remove_value(), set_all_values(), and values_count().

bool Xapian::Document::Internal::values_here [mutable, private]


The documentation for this class was generated from the following files:

Documentation for Xapian (version 1.2.8).
Generated on 14 Dec 2011 by Doxygen 1.5.9.