xapian-core  1.4.20
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 41 of file document.h.

Member Typedef Documentation

◆ document_terms

Type to store terms in.

Definition at line 49 of file document.h.

◆ document_values

Type to store values in.

Definition at line 46 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 219 of file document.h.

◆ Internal() [3/3]

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

Definition at line 224 of file document.h.

◆ ~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.

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

◆ add_term()

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

Definition at line 493 of file omdocument.cc.

◆ add_value()

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

Definition at line 440 of file omdocument.cc.

◆ clear_terms()

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

Definition at line 582 of file omdocument.cc.

◆ clear_values()

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

Definition at line 466 of file omdocument.cc.

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

◆ 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 93 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 96 of file document.h.

◆ 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 92 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.

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

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

◆ 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 Collapser::process().

◆ modified()

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

Return true if the document may have been modified.

Definition at line 196 of file document.h.

◆ need_terms()

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

Definition at line 605 of file omdocument.cc.

References OmDocumentTerm::append_position().

◆ need_values()

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

Definition at line 672 of file omdocument.cc.

References Assert.

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

◆ 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.

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

◆ remove_term()

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

Definition at line 562 of file omdocument.cc.

◆ remove_value()

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

Definition at line 453 of file omdocument.cc.

References Xapian::Internal::str().

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

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

◆ term_positions_modified()

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

Return true if term positions may have been modified.

Definition at line 191 of file document.h.

◆ termlist_count()

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

Definition at line 593 of file omdocument.cc.

References Assert.

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

◆ values_count()

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

Definition at line 625 of file omdocument.cc.

References Assert, LOGCALL, and RETURN.

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

Friends And Related Function Documentation

◆ ::DocumentValueList

friend class ::DocumentValueList
friend

Definition at line 42 of file document.h.

◆ ::ValueStreamDocument

friend class ::ValueStreamDocument
friend

Definition at line 43 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 66 of file document.h.

◆ data_here

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

Definition at line 60 of file document.h.

◆ database

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

The database this document is in.

Definition at line 53 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 63 of file document.h.

◆ 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 80 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 72 of file document.h.

◆ terms_here

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

Definition at line 62 of file document.h.

◆ values

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

The values associated with this document.

Definition at line 69 of file document.h.

◆ values_here

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

Definition at line 61 of file document.h.


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