xapian-core  1.4.25
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GlassTermList Class Reference

A TermList in a glass database. More...

#include <glass_termlist.h>

+ Inheritance diagram for GlassTermList:
+ Collaboration diagram for GlassTermList:

Public Member Functions

 GlassTermList (Xapian::Internal::intrusive_ptr< const GlassDatabase > db_, Xapian::docid did_, bool throw_if_not_present=true)
 Create a new GlassTermList object for document did_ in DB db_. More...
 
Xapian::termcount get_doclength () const
 Return the length of this document. 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...
 
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 &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

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

Private Attributes

Xapian::Internal::intrusive_ptr< const GlassDatabasedb
 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...
 
std::string current_term
 The termname at the current position. 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...
 

Detailed Description

A TermList in a glass database.

Definition at line 41 of file glass_termlist.h.

Constructor & Destructor Documentation

◆ GlassTermList() [1/2]

GlassTermList::GlassTermList ( const GlassTermList )
private

Don't allow copying.

◆ GlassTermList() [2/2]

GlassTermList::GlassTermList ( Xapian::Internal::intrusive_ptr< const GlassDatabase db_,
Xapian::docid  did_,
bool  throw_if_not_present = true 
)

Create a new GlassTermList object for document did_ in DB db_.

Parameters
throw_if_not_presentSpecifies behaviour if document did_ isn't present: if true then throw DocNotFoundError, otherwise the constructed GlassTermList object will signal at_end() before next() is called (normally at_end() isn't meaningful on a freshly constructed TermList).

Definition at line 39 of file glass_termlist.cc.

References data, db, did, doclen, end, GlassTable::get_exact_entry(), LOGCALL_CTOR, GlassTermListTable::make_key(), pos, Xapian::Internal::str(), termlist_size, GlassDatabase::termlist_table, and unpack_uint().

Member Function Documentation

◆ accumulate_stats()

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

◆ at_end()

bool GlassTermList::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 200 of file glass_termlist.cc.

References LOGCALL, pos, and RETURN.

Referenced by accumulate_stats(), GlassWritableDatabase::delete_document(), next(), and GlassWritableDatabase::replace_document().

◆ get_approx_size()

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

Return approximate size of this termlist.

For a GlassTermList, this value will always be exact.

Implements Xapian::TermIterator::Internal.

Definition at line 105 of file glass_termlist.cc.

References LOGCALL, RETURN, and termlist_size.

Referenced by GlassWritableDatabase::get_unique_terms().

◆ get_doclength()

Xapian::termcount GlassTermList::get_doclength ( ) const

Return the length of this document.

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

Definition at line 88 of file glass_termlist.cc.

References doclen, LOGCALL, and RETURN.

Referenced by GlassWritableDatabase::delete_document(), and GlassWritableDatabase::replace_document().

◆ get_termfreq()

Xapian::doccount GlassTermList::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 135 of file glass_termlist.cc.

References current_term, current_termfreq, db, GlassDatabase::get_freqs(), LOGCALL, and RETURN.

Referenced by accumulate_stats().

◆ get_termname()

string GlassTermList::get_termname ( ) const
virtual

Return the termname at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 121 of file glass_termlist.cc.

References current_term, LOGCALL, and RETURN.

Referenced by GlassWritableDatabase::delete_document(), and GlassWritableDatabase::replace_document().

◆ get_unique_terms()

Xapian::termcount GlassTermList::get_unique_terms ( ) const

Return the number of unique terms.

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

Definition at line 95 of file glass_termlist.cc.

References doclen, LOGCALL, RETURN, and termlist_size.

◆ get_wdf()

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

Return the wdf for the term at the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 128 of file glass_termlist.cc.

References current_wdf, LOGCALL, and RETURN.

Referenced by GlassWritableDatabase::delete_document(), and GlassWritableDatabase::replace_document().

◆ next()

TermList * GlassTermList::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 GlassTermList.

Implements Xapian::TermIterator::Internal.

Definition at line 144 of file glass_termlist.cc.

References Assert, at_end(), current_term, current_termfreq, current_wdf, end, LOGCALL, pos, RETURN, and unpack_uint().

Referenced by GlassWritableDatabase::delete_document(), GlassWritableDatabase::replace_document(), and skip_to().

◆ operator=()

void GlassTermList::operator= ( const GlassTermList )
private

Don't allow assignment.

◆ positionlist_begin()

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

Return a PositionIterator for the current position.

Implements Xapian::TermIterator::Internal.

Definition at line 214 of file glass_termlist.cc.

References current_term, db, did, LOGCALL, GlassDatabase::open_position_list(), and RETURN.

◆ positionlist_count()

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

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

Implements Xapian::TermIterator::Internal.

Definition at line 207 of file glass_termlist.cc.

References current_term, db, did, LOGCALL, GlassDatabase::positionlist_count(), and RETURN.

◆ skip_to()

TermList * GlassTermList::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 190 of file glass_termlist.cc.

References current_term, LOGCALL, next(), pos, and RETURN.

Member Data Documentation

◆ current_term

std::string GlassTermList::current_term
private

The termname at the current position.

Definition at line 73 of file glass_termlist.h.

Referenced by get_termfreq(), get_termname(), next(), positionlist_begin(), positionlist_count(), and skip_to().

◆ current_termfreq

Xapian::doccount GlassTermList::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 83 of file glass_termlist.h.

Referenced by get_termfreq(), and next().

◆ current_wdf

Xapian::termcount GlassTermList::current_wdf
private

The wdf for the term at the current position.

Definition at line 76 of file glass_termlist.h.

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

◆ data

std::string GlassTermList::data
private

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

Definition at line 61 of file glass_termlist.h.

Referenced by GlassTermList().

◆ db

Xapian::Internal::intrusive_ptr<const GlassDatabase> GlassTermList::db
private

The database we're reading data from.

Definition at line 49 of file glass_termlist.h.

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

◆ did

Xapian::docid GlassTermList::did
private

The document id that this TermList is for.

Definition at line 52 of file glass_termlist.h.

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

◆ doclen

Xapian::termcount GlassTermList::doclen
private

The length of document did.

Definition at line 55 of file glass_termlist.h.

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

◆ end

const char* GlassTermList::end
private

Pointer to the end of the encoded tag value.

Definition at line 70 of file glass_termlist.h.

Referenced by GlassTermList(), and next().

◆ pos

const char* GlassTermList::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 67 of file glass_termlist.h.

Referenced by at_end(), GlassTermList(), next(), and skip_to().

◆ termlist_size

Xapian::termcount GlassTermList::termlist_size
private

The number of entries in this termlist.

Definition at line 58 of file glass_termlist.h.

Referenced by get_approx_size(), get_unique_terms(), and GlassTermList().


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