QuartzTermList Class Reference

A termlist in a quartz database. More...

#include <quartz_termlist.h>

Inheritance diagram for QuartzTermList:

Inheritance graph
[legend]
Collaboration diagram for QuartzTermList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QuartzTermList (Xapian::Internal::RefCntPtr< const Xapian::Database::Internal > this_db_, const Btree *table_, Xapian::docid did_, Xapian::doccount doccount_)
 Open the termlist for the specified document, for reading.
quartz_doclen_t get_doclength () const
 Get the length of the document represented by the termlist.
Xapian::termcount get_approx_size () const
 Return number of items in termlist.
TermListnext ()
 Move to next entry.
bool at_end () const
 Check whether the termlist reader has reached the end.
string get_termname () const
 Get the current term in the termlist.
Xapian::termcount get_wdf () const
 Get the within document frequency of the current term.
Xapian::doccount get_termfreq () const
 Get the term frequency of the current term - the number of documents containing this term.
void accumulate_stats (Xapian::Internal::ExpandStats &stats) const
 Collate weighting information for the current term.
Xapian::termcount positionlist_count () const
Xapian::PositionIterator positionlist_begin () const

Private Member Functions

 QuartzTermList (const QuartzTermList &)
QuartzTermListoperator= (const QuartzTermList &)

Private Attributes

Xapian::Internal::RefCntPtr<
const Xapian::Database::Internal
this_db
 The database we are searching.
Xapian::docid did
const Btreetable
 The table holding the termlist.
string termlist_part
 The data for the (part of the) termlist currently being read.
const char * pos
 Position within tag that we're reading from.
const char * end
 End of data within tag.
bool have_finished
 Whether we have moved past the final item yet.
quartz_doclen_t doclen
 The length of the document represented by the termlist.
Xapian::termcount termlist_size
 The size of the termlist.
string current_tname
 Current termname.
Xapian::termcount current_wdf
 Current wdf.
bool has_termfreqs
 Whether the termlist stores term frequencies (this cannot be done in an updatable database, but improves expand efficiency considerably).
Xapian::doccount current_termfreq
 Current term frequency.
Xapian::doccount doccount
 Number of documents in database.

Detailed Description

A termlist in a quartz database.

Definition at line 76 of file quartz_termlist.h.


Constructor & Destructor Documentation

QuartzTermList::QuartzTermList ( const QuartzTermList  )  [private]

QuartzTermList::QuartzTermList ( Xapian::Internal::RefCntPtr< const Xapian::Database::Internal this_db_,
const Btree table_,
Xapian::docid  did_,
Xapian::doccount  doccount_ 
)

Open the termlist for the specified document, for reading.

Definition at line 94 of file quartz_termlist.cc.

References Assert, DEBUGCALL, DEBUGLINE, did, doclen, end, Btree::get_exact_entry(), has_termfreqs, om_tostring(), pos, quartz_docid_to_key(), table, termlist_part, termlist_size, unpack_bool(), and unpack_uint().


Member Function Documentation

QuartzTermList& QuartzTermList::operator= ( const QuartzTermList  )  [private]

quartz_doclen_t QuartzTermList::get_doclength (  )  const

Get the length of the document represented by the termlist.

FIXME: having a static version of this available would be nice - database could then avoid having to create a temporary termlist object.

Definition at line 143 of file quartz_termlist.cc.

References DEBUGCALL, doclen, and RETURN.

Referenced by QuartzWritableDatabase::delete_document(), QuartzDatabase::get_doclength(), and QuartzWritableDatabase::replace_document().

Xapian::termcount QuartzTermList::get_approx_size (  )  const

Return number of items in termlist.

(This is actually exact - it may be approximate for combined termlists.)

Definition at line 136 of file quartz_termlist.cc.

References DEBUGCALL, RETURN, and termlist_size.

TermList * QuartzTermList::next (  ) 

Move to next entry.

Must be called before any of the other methods, including at_end(), to move onto the first entry.

Returns:
This method always returns 0. Other values would represent a termlist which should be used to replace this termlist - this never happens.

Definition at line 151 of file quartz_termlist.cc.

References current_termfreq, current_tname, current_wdf, DEBUGCALL, DEBUGLINE, end, has_termfreqs, have_finished, pos, RETURN, and unpack_uint().

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

bool QuartzTermList::at_end (  )  const

Check whether the termlist reader has reached the end.

Definition at line 202 of file quartz_termlist.cc.

References DEBUGCALL, have_finished, and RETURN.

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

string QuartzTermList::get_termname (  )  const

Get the current term in the termlist.

Definition at line 209 of file quartz_termlist.cc.

References current_tname, DEBUGCALL, and RETURN.

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

Xapian::termcount QuartzTermList::get_wdf (  )  const

Get the within document frequency of the current term.

Definition at line 216 of file quartz_termlist.cc.

References current_wdf, DEBUGCALL, and RETURN.

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

Xapian::doccount QuartzTermList::get_termfreq (  )  const

Get the term frequency of the current term - the number of documents containing this term.

For an updateable database, this cannot be stored in the termlist, so involves a relatively expensive lookup in the postlist table.

Definition at line 223 of file quartz_termlist.cc.

References current_termfreq, current_tname, DEBUGCALL, RETURN, and this_db.

Referenced by accumulate_stats().

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

Collate weighting information for the current term.

Definition at line 232 of file quartz_termlist.cc.

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

Xapian::termcount QuartzTermList::positionlist_count (  )  const

Definition at line 240 of file quartz_termlist.cc.

Xapian::PositionIterator QuartzTermList::positionlist_begin (  )  const

Definition at line 246 of file quartz_termlist.cc.

References current_tname, DEBUGCALL, did, and this_db.


Member Data Documentation

Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> QuartzTermList::this_db [private]

The database we are searching.

This pointer is held so that the database doesn't get deleted before us.

Definition at line 85 of file quartz_termlist.h.

Referenced by get_termfreq(), and positionlist_begin().

Xapian::docid QuartzTermList::did [private]

Definition at line 87 of file quartz_termlist.h.

Referenced by positionlist_begin(), and QuartzTermList().

const Btree* QuartzTermList::table [private]

The table holding the termlist.

Definition at line 91 of file quartz_termlist.h.

Referenced by QuartzTermList().

string QuartzTermList::termlist_part [private]

The data for the (part of the) termlist currently being read.

FIXME: currently, we read the whole termlist as one chunk.

Definition at line 97 of file quartz_termlist.h.

Referenced by QuartzTermList().

const char* QuartzTermList::pos [private]

Position within tag that we're reading from.

Definition at line 101 of file quartz_termlist.h.

Referenced by next(), and QuartzTermList().

const char* QuartzTermList::end [private]

End of data within tag.

Definition at line 105 of file quartz_termlist.h.

Referenced by next(), and QuartzTermList().

bool QuartzTermList::have_finished [private]

Whether we have moved past the final item yet.

Definition at line 109 of file quartz_termlist.h.

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

quartz_doclen_t QuartzTermList::doclen [private]

The length of the document represented by the termlist.

Definition at line 114 of file quartz_termlist.h.

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

Xapian::termcount QuartzTermList::termlist_size [private]

The size of the termlist.

Definition at line 118 of file quartz_termlist.h.

Referenced by get_approx_size(), and QuartzTermList().

string QuartzTermList::current_tname [private]

Current termname.

Definition at line 122 of file quartz_termlist.h.

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

Xapian::termcount QuartzTermList::current_wdf [private]

Current wdf.

Definition at line 126 of file quartz_termlist.h.

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

bool QuartzTermList::has_termfreqs [private]

Whether the termlist stores term frequencies (this cannot be done in an updatable database, but improves expand efficiency considerably).

Definition at line 132 of file quartz_termlist.h.

Referenced by next(), and QuartzTermList().

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

Current term frequency.

This will have the value 0 if the term frequency is not available (in which case it will be looked up in the database if requested).

Definition at line 140 of file quartz_termlist.h.

Referenced by get_termfreq(), and next().

Xapian::doccount QuartzTermList::doccount [private]

Number of documents in database.

Definition at line 144 of file quartz_termlist.h.

Referenced by accumulate_stats().


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.