FlintTermList Class Reference

A TermList in a flint database. More...

#include <flint_termlist.h>

Inheritance diagram for FlintTermList:

Inheritance graph
[legend]
Collaboration diagram for FlintTermList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FlintTermList (Xapian::Internal::RefCntPtr< const FlintDatabase > db_, Xapian::docid did_)
 Create a new FlintTermList object for document did_ in DB db_.
flint_doclen_t get_doclength () const
 Return the length of this document.
Xapian::termcount get_approx_size () const
 Return approximate size of this termlist.
void accumulate_stats (Xapian::Internal::ExpandStats &stats) const
 Collate weighting information for the current term.
std::string get_termname () const
 Return the termname at the current position.
Xapian::termcount get_wdf () const
 Return the wdf for the term at the current position.
Xapian::doccount get_termfreq () const
 Return the term frequency for the term at the current position.
TermListnext ()
 Advance the current position to the next term in the termlist.
bool at_end () const
 Return true if the current position is past the last term in this list.
Xapian::termcount positionlist_count () const
 Return the length of the position list for the current position.
Xapian::PositionIterator positionlist_begin () const
 Return a PositionIterator for the current position.

Private Member Functions

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

Private Attributes

Xapian::Internal::RefCntPtr<
const FlintDatabase
db
 The database we're reading data from.
Xapian::docid did
 The document id that this TermList is for.
flint_doclen_t doclen
 The length of document did.
Xapian::termcount termlist_size
 The number of entries in this termlist.
std::string data
 The tag value from the termlist table which holds the encoded termlist.
const char * pos
 Current position with the encoded tag value held in data.
const char * end
 Pointer to the end of the encoded tag value.
std::string current_term
 The termname at the current position.
Xapian::termcount current_wdf
 The wdf for the term at the current position.
Xapian::doccount current_termfreq
 The term frequency for the term at the current position.

Detailed Description

A TermList in a flint database.

Definition at line 41 of file flint_termlist.h.


Constructor & Destructor Documentation

FlintTermList::FlintTermList ( const FlintTermList  )  [private]

Don't allow copying.

FlintTermList::FlintTermList ( Xapian::Internal::RefCntPtr< const FlintDatabase db_,
Xapian::docid  did_ 
)

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

Definition at line 36 of file flint_termlist.cc.

References data, db, DEBUGCALL, did, doclen, end, flint_docid_to_key(), om_tostring(), pos, termlist_size, and unpack_uint().


Member Function Documentation

void FlintTermList::operator= ( const FlintTermList  )  [private]

Don't allow assignment.

flint_doclen_t FlintTermList::get_doclength (  )  const

Return the length of this document.

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

Definition at line 83 of file flint_termlist.cc.

References DEBUGCALL, doclen, and RETURN.

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

Xapian::termcount FlintTermList::get_approx_size (  )  const

Return approximate size of this termlist.

For a FlintTermList, this value will always be exact.

Definition at line 90 of file flint_termlist.cc.

References DEBUGCALL, RETURN, and termlist_size.

void FlintTermList::accumulate_stats ( Xapian::Internal::ExpandStats stats  )  const

Collate weighting information for the current term.

Definition at line 97 of file flint_termlist.cc.

References Xapian::Internal::ExpandStats::accumulate(), Assert, at_end(), current_wdf, db, DEBUGCALL, doclen, and get_termfreq().

string FlintTermList::get_termname (  )  const

Return the termname at the current position.

Definition at line 105 of file flint_termlist.cc.

References current_term, DEBUGCALL, and RETURN.

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

Xapian::termcount FlintTermList::get_wdf (  )  const

Return the wdf for the term at the current position.

Definition at line 112 of file flint_termlist.cc.

References current_wdf, DEBUGCALL, and RETURN.

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

Xapian::doccount FlintTermList::get_termfreq (  )  const

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

Definition at line 119 of file flint_termlist.cc.

References current_term, current_termfreq, db, DEBUGCALL, and RETURN.

Referenced by accumulate_stats().

TermList * FlintTermList::next (  ) 

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

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

Returns:
Always returns 0 for a FlintTermList.

Definition at line 128 of file flint_termlist.cc.

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

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

bool FlintTermList::at_end (  )  const

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

Definition at line 174 of file flint_termlist.cc.

References DEBUGCALL, pos, and RETURN.

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

Xapian::termcount FlintTermList::positionlist_count (  )  const

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

Definition at line 181 of file flint_termlist.cc.

References current_term, db, DEBUGCALL, did, and RETURN.

Xapian::PositionIterator FlintTermList::positionlist_begin (  )  const

Return a PositionIterator for the current position.

Definition at line 188 of file flint_termlist.cc.

References current_term, db, DEBUGCALL, and did.


Member Data Documentation

Xapian::Internal::RefCntPtr<const FlintDatabase> FlintTermList::db [private]

The database we're reading data from.

Definition at line 49 of file flint_termlist.h.

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

Xapian::docid FlintTermList::did [private]

The document id that this TermList is for.

Definition at line 52 of file flint_termlist.h.

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

flint_doclen_t FlintTermList::doclen [private]

The length of document did.

Definition at line 55 of file flint_termlist.h.

Referenced by accumulate_stats(), FlintTermList(), and get_doclength().

Xapian::termcount FlintTermList::termlist_size [private]

The number of entries in this termlist.

Definition at line 58 of file flint_termlist.h.

Referenced by FlintTermList(), and get_approx_size().

std::string FlintTermList::data [private]

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

Definition at line 61 of file flint_termlist.h.

Referenced by FlintTermList().

const char* FlintTermList::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 flint_termlist.h.

Referenced by at_end(), FlintTermList(), and next().

const char* FlintTermList::end [private]

Pointer to the end of the encoded tag value.

Definition at line 70 of file flint_termlist.h.

Referenced by FlintTermList(), and next().

std::string FlintTermList::current_term [private]

The termname at the current position.

Definition at line 73 of file flint_termlist.h.

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

Xapian::termcount FlintTermList::current_wdf [private]

The wdf for the term at the current position.

Definition at line 76 of file flint_termlist.h.

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

Xapian::doccount FlintTermList::current_termfreq [mutable, private]

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 flint_termlist.h.

Referenced by get_termfreq(), and next().


The documentation for this class was generated from the following files:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.