xapian-core  1.4.27
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
NetworkTermList Class Reference

A term list for a database on the other side of a network connection. More...

#include <net_termlist.h>

+ Inheritance diagram for NetworkTermList:
+ Collaboration diagram for NetworkTermList:

Public Member Functions

Xapian::termcount get_approx_size () const
 Get the number of terms in the termlist. More...
 
void accumulate_stats (Xapian::Internal::ExpandStats &stats) const
 Collate weighting information for the current term. More...
 
string get_termname () const
 Return the termname at the current position. More...
 
Xapian::termcount get_wdf () const
 Return the wdf for the term at the current position. More...
 
Xapian::doccount get_termfreq () const
 Return the term frequency for the term at the current position. More...
 
TermListnext ()
 Advance the current position to the next term in the termlist. More...
 
TermListskip_to (const std::string &term)
 Skip forward to the specified term. More...
 
bool at_end () const
 Return true if the current position is past the last term in this list. More...
 
Xapian::termcount positionlist_count () const
 Return the length of the position list for the current position. More...
 
Xapian::PositionIterator positionlist_begin () const
 Return a PositionIterator for the current position. More...
 
- Public Member Functions inherited from Xapian::TermIterator::Internal
virtual ~Internal ()
 We have virtual methods and want to be able to delete derived classes using a pointer to the base class, so we need a virtual destructor. More...
 
virtual const std::vector< Xapian::termpos > * get_vector_termpos () const
 Get pointer to vector<termpos> if that's the internal representation. More...
 
- Public Member Functions inherited from Xapian::Internal::intrusive_base
 intrusive_base ()
 Construct with no references. More...
 

Private Member Functions

 NetworkTermList (Xapian::termcount document_length_, Xapian::doccount database_size_, Xapian::Internal::intrusive_ptr< const RemoteDatabase > this_db_, Xapian::docid did_)
 Standard constructor is private: NetworkTermLists are created by RemoteDatabase object only, which is a friend. More...
 

Private Attributes

vector< NetworkTermListItemitems
 The list of items comprising the termlist. More...
 
vector< NetworkTermListItem >::const_iterator current_position
 The current position in the list. More...
 
bool started
 Whether we have yet started iterating through the list. More...
 
Xapian::termcount document_length
 The length of the document for which this is the termlist. More...
 
Xapian::doccount database_size
 The number of documents in the database in which this document resides. More...
 
Xapian::Internal::intrusive_ptr< const RemoteDatabasethis_db
 Keep a reference to our database. More...
 
Xapian::docid did
 The id of the document this termlist came from (or 0 if not applicable). More...
 

Friends

class RemoteDatabase
 

Additional Inherited Members

- Public Attributes inherited from Xapian::TermIterator::Internal
size_t shard_index = 0
 Which shard of a multidatabase this is from. More...
 
- Public Attributes inherited from Xapian::Internal::intrusive_base
unsigned _refs
 Reference count. More...
 
- Protected Member Functions inherited from Xapian::TermIterator::Internal
 Internal ()
 Only constructable as a base class for derived classes. More...
 

Detailed Description

A term list for a database on the other side of a network connection.

The termlist is serialised across the network, and rebuilt into this object on the client side.

Definition at line 62 of file net_termlist.h.

Constructor & Destructor Documentation

◆ NetworkTermList()

NetworkTermList::NetworkTermList ( Xapian::termcount  document_length_,
Xapian::doccount  database_size_,
Xapian::Internal::intrusive_ptr< const RemoteDatabase this_db_,
Xapian::docid  did_ 
)
private

Standard constructor is private: NetworkTermLists are created by RemoteDatabase object only, which is a friend.

Parameters
document_length_The (non-normalised) length of the document
database_size_The number of documents in the database
this_db_The database
did_The document id

Definition at line 32 of file net_termlist.cc.

Member Function Documentation

◆ accumulate_stats()

void NetworkTermList::accumulate_stats ( Xapian::Internal::ExpandStats stats) const
virtual

Collate weighting information for the current term.

Reimplemented from Xapian::TermIterator::Internal.

Definition at line 53 of file net_termlist.cc.

References Xapian::Internal::ExpandStats::accumulate(), Assert, at_end(), current_position, database_size, document_length, Xapian::TermIterator::Internal::shard_index, and started.

◆ at_end()

bool NetworkTermList::at_end ( ) const
virtual

Return true if the current position is past the last term in this list.

Implements Xapian::TermIterator::Internal.

Definition at line 112 of file net_termlist.cc.

References Assert, current_position, items, and started.

Referenced by accumulate_stats(), get_termfreq(), get_termname(), get_wdf(), and next().

◆ get_approx_size()

Xapian::termcount NetworkTermList::get_approx_size ( ) const
virtual

Get the number of terms in the termlist.

Implements Xapian::TermIterator::Internal.

Definition at line 47 of file net_termlist.cc.

References items.

◆ get_termfreq()

Xapian::doccount NetworkTermList::get_termfreq ( ) const
virtual

Return the term frequency for the term at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 82 of file net_termlist.cc.

References Assert, at_end(), current_position, and started.

◆ get_termname()

string NetworkTermList::get_termname ( ) const
virtual

Return the termname at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 66 of file net_termlist.cc.

References Assert, at_end(), current_position, and started.

Referenced by positionlist_begin().

◆ get_wdf()

Xapian::termcount NetworkTermList::get_wdf ( ) const
virtual

Return the wdf for the term at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 74 of file net_termlist.cc.

References Assert, at_end(), current_position, and started.

◆ next()

TermList * NetworkTermList::next ( )
virtual

Advance the current position to the next term in the termlist.

The list starts before the first term in the list, so next(), skip_to() or check() must be called before any methods which need the context of the current position.

Returns
If a non-NULL pointer is returned, then the caller should substitute the returned pointer for its pointer to us, and then delete us. This "pruning" can only happen for a non-leaf subclass of this class.

Implements Xapian::TermIterator::Internal.

Definition at line 90 of file net_termlist.cc.

References Assert, at_end(), current_position, and started.

◆ positionlist_begin()

Xapian::PositionIterator NetworkTermList::positionlist_begin ( ) const
virtual

Return a PositionIterator for the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 125 of file net_termlist.cc.

References did, get_termname(), RemoteDatabase::open_position_list(), and this_db.

◆ positionlist_count()

Xapian::termcount NetworkTermList::positionlist_count ( ) const
virtual

Return the length of the position list for the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 119 of file net_termlist.cc.

◆ skip_to()

TermList * NetworkTermList::skip_to ( const std::string &  term)
virtual

Skip forward to the specified term.

If the specified term isn't in the list, position ourselves on the first term after tname (or at_end() if no terms after tname exist).

Implements Xapian::TermIterator::Internal.

Definition at line 102 of file net_termlist.cc.

References current_position, items, and started.

Friends And Related Function Documentation

◆ RemoteDatabase

friend class RemoteDatabase
friend

Definition at line 63 of file net_termlist.h.

Member Data Documentation

◆ current_position

vector<NetworkTermListItem>::const_iterator NetworkTermList::current_position
private

The current position in the list.

Definition at line 71 of file net_termlist.h.

Referenced by accumulate_stats(), at_end(), get_termfreq(), get_termname(), get_wdf(), next(), and skip_to().

◆ database_size

Xapian::doccount NetworkTermList::database_size
private

The number of documents in the database in which this document resides.

Note that this may not be the number of documents in the combined database when multiple databases are being searched.

Definition at line 89 of file net_termlist.h.

Referenced by accumulate_stats().

◆ did

Xapian::docid NetworkTermList::did
private

The id of the document this termlist came from (or 0 if not applicable).

Definition at line 95 of file net_termlist.h.

Referenced by positionlist_begin().

◆ document_length

Xapian::termcount NetworkTermList::document_length
private

The length of the document for which this is the termlist.

Note that this is not a normalised document length.

Definition at line 81 of file net_termlist.h.

Referenced by accumulate_stats().

◆ items

vector<NetworkTermListItem> NetworkTermList::items
private

The list of items comprising the termlist.

Definition at line 67 of file net_termlist.h.

Referenced by at_end(), get_approx_size(), and skip_to().

◆ started

bool NetworkTermList::started
private

Whether we have yet started iterating through the list.

Definition at line 75 of file net_termlist.h.

Referenced by accumulate_stats(), at_end(), get_termfreq(), get_termname(), get_wdf(), next(), and skip_to().

◆ this_db

Xapian::Internal::intrusive_ptr<const RemoteDatabase> NetworkTermList::this_db
private

Keep a reference to our database.

Definition at line 92 of file net_termlist.h.

Referenced by positionlist_begin().


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