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

This class stores a list of terms. More...

#include <vectortermlist.h>

+ Inheritance diagram for VectorTermList:
+ Collaboration diagram for VectorTermList:

Public Member Functions

template<typename I >
 VectorTermList (I begin, I end)
 
Xapian::termcount get_approx_size () const
 Return approximate size of this termlist. More...
 
std::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 &)
 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 void accumulate_stats (Xapian::Internal::ExpandStats &stats) const
 Collate weighting information for the current term. 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 Attributes

std::string data
 The encoded terms. More...
 
const char * p
 Pointer to the next term's data, or NULL if we are at end. More...
 
Xapian::termcount num_terms
 The number of terms in the list. More...
 
std::string current_term
 The current term. More...
 

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

This class stores a list of terms.

To be memory efficient, we store the terms in a single string using a suitable simple encoding. This way the number of bytes needed will usually be the sum of the lengths of all the terms plus the number of terms. If we used std::vector<std::string> here like we used to, that would need something like an additional 30 bytes per term (30 calculated for GCC 4.x on x86_64).

Definition at line 38 of file vectortermlist.h.

Constructor & Destructor Documentation

◆ VectorTermList()

template<typename I >
VectorTermList::VectorTermList ( begin,
end 
)
inline

Member Function Documentation

◆ at_end()

bool VectorTermList::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 89 of file vectortermlist.cc.

Referenced by get_termname(), get_wdf(), next(), and VectorTermList().

◆ get_approx_size()

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

Return approximate size of this termlist.

Implements Xapian::TermIterator::Internal.

Definition at line 32 of file vectortermlist.cc.

Referenced by VectorTermList().

◆ get_termfreq()

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

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

Implements Xapian::TermIterator::Internal.

Definition at line 56 of file vectortermlist.cc.

Referenced by VectorTermList().

◆ get_termname()

string VectorTermList::get_termname ( ) const
virtual

Return the termname at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 38 of file vectortermlist.cc.

References Assert, and at_end().

Referenced by VectorTermList().

◆ get_wdf()

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

Return the wdf for the term at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 47 of file vectortermlist.cc.

References Assert, and at_end().

Referenced by VectorTermList().

◆ next()

TermList * VectorTermList::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 62 of file vectortermlist.cc.

References Assert, at_end(), and decode_length_and_check().

Referenced by VectorTermList().

◆ positionlist_begin()

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

Return a PositionIterator for the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 101 of file vectortermlist.cc.

Referenced by VectorTermList().

◆ positionlist_count()

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

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

Implements Xapian::TermIterator::Internal.

Definition at line 95 of file vectortermlist.cc.

Referenced by VectorTermList().

◆ skip_to()

TermList * VectorTermList::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 82 of file vectortermlist.cc.

Referenced by VectorTermList().

Member Data Documentation

◆ current_term

std::string VectorTermList::current_term
private

The current term.

Definition at line 49 of file vectortermlist.h.

◆ data

std::string VectorTermList::data
private

The encoded terms.

Definition at line 40 of file vectortermlist.h.

◆ num_terms

Xapian::termcount VectorTermList::num_terms
private

The number of terms in the list.

Definition at line 46 of file vectortermlist.h.

Referenced by VectorTermList().

◆ p

const char* VectorTermList::p
private

Pointer to the next term's data, or NULL if we are at end.

Definition at line 43 of file vectortermlist.h.


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