xapian-core  2.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HoneyTermList Class Reference

A TermList in a honey database. More...

#include <honey_termlist.h>

+ Inheritance diagram for HoneyTermList:
+ Collaboration diagram for HoneyTermList:

Public Member Functions

 HoneyTermList (const HoneyDatabase *db_, Xapian::docid did_)
 Create a new HoneyTermList object for document did_ in DB db_. More...
 
Xapian::termcount get_doclength () const
 Return the length of this document. More...
 
Xapian::termcount size () const
 Return the number of entries in this termlist. More...
 
Xapian::termcount get_unique_terms () const
 Return the number of unique terms. More...
 
Xapian::termcount get_approx_size () const
 Return approximate size of this termlist. More...
 
void accumulate_stats (Xapian::Internal::ExpandStats &stats) const
 Collate weighting information for the current term. 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 (std::string_view term)
 Skip forward to the specified term. More...
 
Xapian::termcount positionlist_count () const
 Return the length of the position list for the current position. More...
 
PositionListpositionlist_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...
 
const std::string & get_termname () const
 Return the termname at the current position. More...
 
virtual const Xapian::VecCOW< Xapian::termpos > * get_vec_termpos () const
 Get pointer to VecCOW<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

void operator= (const HoneyTermList &)
 Don't allow assignment. More...
 
 HoneyTermList (const HoneyTermList &)
 Don't allow copying. More...
 

Private Attributes

Xapian::Internal::intrusive_ptr< const HoneyDatabasedb
 The database we're reading data from. More...
 
Xapian::docid did
 The document id that this TermList is for. More...
 
Xapian::termcount doclen
 The length of document did. More...
 
Xapian::termcount termlist_size
 The number of entries in this termlist. More...
 
std::string data
 The tag value from the termlist table which holds the encoded termlist. More...
 
const char * pos
 Current position with the encoded tag value held in data. More...
 
const char * end
 Pointer to the end of the encoded tag value. More...
 
Xapian::termcount current_wdf
 The wdf for the term at the current position. More...
 
Xapian::doccount current_termfreq
 The term frequency for the term at the current position. 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...
 
- Protected Attributes inherited from Xapian::TermIterator::Internal
std::string current_term
 The current term. More...
 

Detailed Description

A TermList in a honey database.

Definition at line 42 of file honey_termlist.h.

Constructor & Destructor Documentation

◆ HoneyTermList() [1/2]

HoneyTermList::HoneyTermList ( const HoneyTermList )
private

Don't allow copying.

◆ HoneyTermList() [2/2]

HoneyTermList::HoneyTermList ( const HoneyDatabase db_,
Xapian::docid  did_ 
)

Member Function Documentation

◆ accumulate_stats()

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

◆ get_approx_size()

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

Return approximate size of this termlist.

For a HoneyTermList, this value will always be exact.

Implements Xapian::TermIterator::Internal.

Definition at line 94 of file honey_termlist.cc.

References termlist_size.

◆ get_doclength()

Xapian::termcount HoneyTermList::get_doclength ( ) const
inline

Return the length of this document.

This is a non-virtual method, used by HoneyDatabase.

Definition at line 91 of file honey_termlist.h.

References doclen.

◆ get_termfreq()

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

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

In order to be able to support updating databases efficiently, we can't store this value in the termlist table, so it has to be read from the postlist table, which is relatively expensive (compared to reading the wdf for example).

Implements Xapian::TermIterator::Internal.

Definition at line 118 of file honey_termlist.cc.

References Assert, Xapian::TermIterator::Internal::current_term, current_termfreq, db, HoneyDatabase::get_freqs(), and pos.

Referenced by accumulate_stats().

◆ get_unique_terms()

Xapian::termcount HoneyTermList::get_unique_terms ( ) const
inline

Return the number of unique terms.

This is a non-virtual method, used by HoneyDatabase.

Definition at line 107 of file honey_termlist.h.

References doclen, and termlist_size.

◆ get_wdf()

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

Return the wdf for the term at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 111 of file honey_termlist.cc.

References Assert, current_wdf, and pos.

Referenced by HoneyDatabase::get_wdfdocmax().

◆ next()

TermList * HoneyTermList::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
Always returns 0 for a HoneyTermList.

Implements Xapian::TermIterator::Internal.

Definition at line 127 of file honey_termlist.cc.

References Assert, Xapian::TermIterator::Internal::current_term, current_termfreq, current_wdf, end, pos, throw_database_corrupt(), and unpack_uint().

Referenced by HoneyDatabase::get_wdfdocmax(), and skip_to().

◆ operator=()

void HoneyTermList::operator= ( const HoneyTermList )
private

Don't allow assignment.

◆ positionlist_begin()

PositionList * HoneyTermList::positionlist_begin ( ) const
virtual

Return a PositionIterator for the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 187 of file honey_termlist.cc.

References Xapian::TermIterator::Internal::current_term, db, did, and HoneyDatabase::open_position_list().

◆ positionlist_count()

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

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

Implements Xapian::TermIterator::Internal.

Definition at line 181 of file honey_termlist.cc.

References Xapian::TermIterator::Internal::current_term, db, did, HoneyDatabase::position_table, and HoneyPositionTable::positionlist_count().

◆ size()

Xapian::termcount HoneyTermList::size ( ) const
inline

Return the number of entries in this termlist.

This is a non-virtual method, used by HoneyDatabase.

Definition at line 99 of file honey_termlist.h.

References termlist_size.

Referenced by HoneyDatabase::open_term_list().

◆ skip_to()

TermList * HoneyTermList::skip_to ( std::string_view  term)
virtual

Skip forward to the specified term.

If the specified term isn't in the list, position ourselves on the first term after term.

Returns
Normally returns NULL to indicate success. If no terms after term exist, returns this; if another 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 171 of file honey_termlist.cc.

References Xapian::TermIterator::Internal::current_term, next(), and term.

Member Data Documentation

◆ current_termfreq

Xapian::doccount HoneyTermList::current_termfreq
mutableprivate

The term frequency for the term at the current position.

This will have the value 0 if the term frequency has not yet been looked up in the database (so it needs to be mutable).

Definition at line 81 of file honey_termlist.h.

Referenced by get_termfreq(), and next().

◆ current_wdf

Xapian::termcount HoneyTermList::current_wdf
private

The wdf for the term at the current position.

Definition at line 74 of file honey_termlist.h.

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

◆ data

std::string HoneyTermList::data
private

The tag value from the termlist table which holds the encoded termlist.

Definition at line 62 of file honey_termlist.h.

Referenced by HoneyTermList().

◆ db

Xapian::Internal::intrusive_ptr<const HoneyDatabase> HoneyTermList::db
private

The database we're reading data from.

Definition at line 50 of file honey_termlist.h.

Referenced by accumulate_stats(), get_termfreq(), HoneyTermList(), positionlist_begin(), and positionlist_count().

◆ did

Xapian::docid HoneyTermList::did
private

The document id that this TermList is for.

Definition at line 53 of file honey_termlist.h.

Referenced by HoneyTermList(), positionlist_begin(), and positionlist_count().

◆ doclen

Xapian::termcount HoneyTermList::doclen
private

The length of document did.

Definition at line 56 of file honey_termlist.h.

Referenced by accumulate_stats(), get_doclength(), get_unique_terms(), and HoneyTermList().

◆ end

const char* HoneyTermList::end
private

Pointer to the end of the encoded tag value.

Definition at line 71 of file honey_termlist.h.

Referenced by HoneyTermList(), and next().

◆ pos

const char* HoneyTermList::pos
private

Current position with the encoded tag value held in data.

If we've iterated to the end of the list, this gets set to NULL.

Definition at line 68 of file honey_termlist.h.

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

◆ termlist_size

Xapian::termcount HoneyTermList::termlist_size
private

The number of entries in this termlist.

Definition at line 59 of file honey_termlist.h.

Referenced by get_approx_size(), get_unique_terms(), HoneyTermList(), and size().


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