xapian-core  1.4.27
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Xapian::Document::Internal Class Reference

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

#include <document.h>

+ Inheritance diagram for Xapian::Document::Internal:
+ Collaboration diagram for Xapian::Document::Internal:

Public Types

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

Public Member Functions

string get_value (Xapian::valueno slot) const
 Get value by value number. More...
 
void set_all_values (map< Xapian::valueno, string > &values_)
 Set all the values. More...
 
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)
 
Xapian::termpos remove_postings (const string &, Xapian::termpos, 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. More...
 
void set_data (const string &)
 
TermListopen_term_list () const
 Open a term list. More...
 
void need_values () const
 
void need_terms () const
 
bool data_modified () const
 Return true if the data in the document may have been modified. More...
 
bool values_modified () const
 Return true if the values in the document may have been modified. More...
 
bool terms_modified () const
 Return true if the terms in the document may have been modified. More...
 
bool term_positions_modified () const
 Return true if term positions may have been modified. More...
 
bool modified () const
 Return true if the document may have been modified. More...
 
Xapian::docid get_docid () const
 Get the docid which is associated with this document (if any). More...
 
string get_description () const
 Return a string describing this object. More...
 
 Internal (Xapian::Internal::intrusive_ptr< const Xapian::Database::Internal > database_, Xapian::docid did_)
 Constructor. More...
 
 Internal ()
 
virtual ~Internal ()
 Destructor. More...
 
- Public Member Functions inherited from Xapian::Internal::intrusive_base
 intrusive_base ()
 Construct with no references. More...
 

Protected Attributes

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

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. More...
 
document_values values
 The values associated with this document. More...
 
document_terms terms
 The terms (and their frequencies and positions) in this document. More...
 
Xapian::termcount termlist_size
 The number of distinct terms in terms. More...
 

Friends

class ::DocumentValueList
 
class ::ValueStreamDocument
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::intrusive_base
unsigned _refs
 Reference count. More...
 

Detailed Description

A document in the database, possibly plus modifications.

Definition at line 43 of file document.h.

Member Typedef Documentation

◆ document_terms

Type to store terms in.

Definition at line 51 of file document.h.

◆ document_values

Type to store values in.

Definition at line 48 of file document.h.

Constructor & Destructor Documentation

◆ Internal() [1/3]

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

◆ Internal() [2/3]

Xapian::Document::Internal::Internal ( Xapian::Internal::intrusive_ptr< 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 221 of file document.h.

◆ Internal() [3/3]

Xapian::Document::Internal::Internal ( )
inline

Definition at line 226 of file document.h.

References ~Internal().

◆ ~Internal()

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 683 of file omdocument.cc.

Referenced by Internal().

Member Function Documentation

◆ add_posting()

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

Definition at line 473 of file omdocument.cc.

References OmDocumentTerm::append_position().

Referenced by set_all_values().

◆ add_term()

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

Definition at line 493 of file omdocument.cc.

Referenced by set_all_values().

◆ add_value()

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

Definition at line 440 of file omdocument.cc.

Referenced by set_all_values().

◆ clear_terms()

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

Definition at line 582 of file omdocument.cc.

Referenced by set_all_values().

◆ clear_values()

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

Definition at line 466 of file omdocument.cc.

Referenced by set_all_values().

◆ data_modified()

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

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

Definition at line 176 of file document.h.

References data_here.

◆ do_get_all_values()

virtual void Xapian::Document::Internal::do_get_all_values ( map< Xapian::valueno, string > &  values_) const
inlineprivatevirtual

Reimplemented in ValueStreamDocument, ChertDocument, GlassDocument, RemoteDocument, and InMemoryDocument.

Definition at line 95 of file document.h.

◆ do_get_data()

virtual string Xapian::Document::Internal::do_get_data ( ) const
inlineprivatevirtual

Reimplemented in ValueStreamDocument, ChertDocument, GlassDocument, RemoteDocument, and InMemoryDocument.

Definition at line 98 of file document.h.

References get_value().

◆ do_get_value()

virtual string Xapian::Document::Internal::do_get_value ( Xapian::valueno  ) const
inlineprivatevirtual

Reimplemented in ValueStreamDocument, ChertDocument, GlassDocument, RemoteDocument, and InMemoryDocument.

Definition at line 94 of file document.h.

◆ get_data()

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
A string containing the data for this document.

Definition at line 413 of file omdocument.cc.

References LOGCALL, and RETURN.

Referenced by set_all_values().

◆ get_description()

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

Return a string describing this object.

Definition at line 634 of file omdocument.cc.

References description_append(), and Xapian::Internal::str().

Referenced by get_docid().

◆ get_docid()

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 211 of file document.h.

References did, and get_description().

◆ get_value()

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
slotThe 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

Definition at line 400 of file omdocument.cc.

Referenced by do_get_data(), and Collapser::process().

◆ modified()

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

Return true if the document may have been modified.

Definition at line 198 of file document.h.

References data_here.

◆ need_terms()

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

Definition at line 605 of file omdocument.cc.

References OmDocumentTerm::append_position().

Referenced by set_all_values().

◆ need_values()

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

Definition at line 672 of file omdocument.cc.

References Assert.

Referenced by set_all_values().

◆ open_term_list()

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 429 of file omdocument.cc.

References LOGCALL, and RETURN.

Referenced by InMemoryDatabase::is_closed(), and set_all_values().

◆ operator=()

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

◆ remove_posting()

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

Definition at line 510 of file omdocument.cc.

Referenced by set_all_values().

◆ remove_postings()

Xapian::termpos Xapian::Document::Internal::remove_postings ( const string &  term,
Xapian::termpos  termpos_first,
Xapian::termpos  termpos_last,
Xapian::termcount  wdf_dec 
)

Definition at line 531 of file omdocument.cc.

References mul_overflows().

Referenced by set_all_values().

◆ remove_term()

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

Definition at line 562 of file omdocument.cc.

Referenced by set_all_values().

◆ remove_value()

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

Definition at line 453 of file omdocument.cc.

References Xapian::Internal::str().

Referenced by set_all_values().

◆ set_all_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 124 of file document.h.

References add_posting(), add_term(), add_value(), clear_terms(), clear_values(), get_data(), need_terms(), need_values(), open_term_list(), remove_posting(), remove_postings(), remove_term(), remove_value(), set_data(), termlist_count(), and values_count().

Referenced by RemoteDocument::RemoteDocument().

◆ set_data()

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

Definition at line 422 of file omdocument.cc.

Referenced by RemoteDocument::RemoteDocument(), and set_all_values().

◆ term_positions_modified()

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

Return true if term positions may have been modified.

Definition at line 193 of file document.h.

References positions_modified.

◆ termlist_count()

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

Definition at line 593 of file omdocument.cc.

References Assert.

Referenced by set_all_values().

◆ terms_modified()

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

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

Definition at line 188 of file document.h.

References terms_here.

◆ values_count()

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

Definition at line 625 of file omdocument.cc.

References Assert, LOGCALL, and RETURN.

Referenced by set_all_values().

◆ values_modified()

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

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

Definition at line 182 of file document.h.

References values_here.

Friends And Related Function Documentation

◆ ::DocumentValueList

friend class ::DocumentValueList
friend

Definition at line 44 of file document.h.

◆ ::ValueStreamDocument

friend class ::ValueStreamDocument
friend

Definition at line 45 of file document.h.

Member Data Documentation

◆ data

string Xapian::Document::Internal::data
private

The (user defined) data associated with this document.

Definition at line 68 of file document.h.

◆ data_here

bool Xapian::Document::Internal::data_here
private

Definition at line 62 of file document.h.

Referenced by data_modified(), and modified().

◆ database

Xapian::Internal::intrusive_ptr<const Xapian::Database::Internal> Xapian::Document::Internal::database
protected

The database this document is in.

Definition at line 55 of file document.h.

Referenced by InMemoryDocument::do_get_all_values(), InMemoryDocument::do_get_data(), and InMemoryDocument::do_get_value().

◆ did

Xapian::docid Xapian::Document::Internal::did
protected

◆ positions_modified

bool Xapian::Document::Internal::positions_modified
mutableprivate

Definition at line 65 of file document.h.

Referenced by term_positions_modified().

◆ termlist_size

Xapian::termcount Xapian::Document::Internal::termlist_size
mutableprivate

The number of distinct terms in terms.

Only valid when terms_here is true.

This may be less than terms.size() if any terms have been deleted.

Definition at line 82 of file document.h.

◆ terms

document_terms Xapian::Document::Internal::terms
mutableprivate

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

Definition at line 74 of file document.h.

◆ terms_here

bool Xapian::Document::Internal::terms_here
mutableprivate

Definition at line 64 of file document.h.

Referenced by terms_modified().

◆ values

document_values Xapian::Document::Internal::values
mutableprivate

The values associated with this document.

Definition at line 71 of file document.h.

◆ values_here

bool Xapian::Document::Internal::values_here
mutableprivate

Definition at line 63 of file document.h.

Referenced by values_modified().


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