ChertPostListTable Class Reference

#include <chert_postlist.h>

Inheritance diagram for ChertPostListTable:

Inheritance graph
[legend]
Collaboration diagram for ChertPostListTable:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ChertPostListTable (const string &path_, bool readonly_)
 Create a new table object.
bool open (chert_revision_number_t revno)
 Open the btree at a given revision.
void merge_changes (const map< string, map< Xapian::docid, pair< char, Xapian::termcount > > > &mod_plists, const map< Xapian::docid, Xapian::termcount > &doclens, const map< string, pair< Xapian::termcount_diff, Xapian::termcount_diff > > &freq_deltas)
 Merge added, removed, and changed entries.
Xapian::docid get_chunk (const string &tname, Xapian::docid did, bool adding, Chert::PostlistChunkReader **from, Chert::PostlistChunkWriter **to)
bool term_exists (const string &term) const
Xapian::doccount get_termfreq (const std::string &term) const
 Returns number of docs indexed by term.
Xapian::termcount get_collection_freq (const std::string &term) const
 Returns the number of occurrences of term in the database.
Xapian::termcount get_doclength (Xapian::docid did, Xapian::Internal::RefCntPtr< const ChertDatabase > db) const
 Returns the length of document did.
bool document_exists (Xapian::docid did, Xapian::Internal::RefCntPtr< const ChertDatabase > db) const
 Check if document did exists.

Static Public Member Functions

static string make_key (const string &term, Xapian::docid did)
 Compose a key from a termname and docid.
static string make_key (const string &term)
 Compose a key from a termname.

Private Attributes

AutoPtr< ChertPostListdoclen_pl
 PostList for looking up document lengths.


Detailed Description

Definition at line 50 of file chert_postlist.h.


Constructor & Destructor Documentation

ChertPostListTable::ChertPostListTable ( const string &  path_,
bool  readonly_ 
) [inline]

Create a new table object.

This does not create the table on disk - the create() method must be called before the table is created on disk

This also does not open the table - the open() method must be called before use is made of the table.

Parameters:
path_ - Path at which the table is stored.
readonly_ - whether to open the table for read only access.

Definition at line 67 of file chert_postlist.h.


Member Function Documentation

bool ChertPostListTable::document_exists ( Xapian::docid  did,
Xapian::Internal::RefCntPtr< const ChertDatabase db 
) const

Check if document did exists.

Definition at line 74 of file chert_postlist.cc.

References doclen_pl.

Referenced by ChertWritableDatabase::replace_document().

Xapian::docid ChertPostListTable::get_chunk ( const string &  tname,
Xapian::docid  did,
bool  adding,
Chert::PostlistChunkReader **  from,
Chert::PostlistChunkWriter **  to 
)

Xapian::termcount ChertPostListTable::get_collection_freq ( const std::string &  term  )  const

Returns the number of occurrences of term in the database.

This is the sum of the wdfs in the postlist.

Definition at line 48 of file chert_postlist.cc.

References ChertTable::get_exact_entry(), make_key(), and ChertPostList::read_number_of_entries().

Referenced by ChertDatabase::get_collection_freq().

Xapian::termcount ChertPostListTable::get_doclength ( Xapian::docid  did,
Xapian::Internal::RefCntPtr< const ChertDatabase db 
) const

Returns the length of document did.

Definition at line 61 of file chert_postlist.cc.

References doclen_pl, and Xapian::Internal::str().

Referenced by ChertDatabase::get_doclength().

Xapian::doccount ChertPostListTable::get_termfreq ( const std::string &  term  )  const

Returns number of docs indexed by term.

This is the length of the postlist.

Definition at line 35 of file chert_postlist.cc.

References ChertTable::get_exact_entry(), make_key(), and ChertPostList::read_number_of_entries().

Referenced by ChertDatabase::get_termfreq().

static string ChertPostListTable::make_key ( const string &  term  )  [inline, static]

Compose a key from a termname.

Definition at line 94 of file chert_postlist.h.

References pack_chert_postlist_key().

static string ChertPostListTable::make_key ( const string &  term,
Xapian::docid  did 
) [inline, static]

Compose a key from a termname and docid.

Definition at line 89 of file chert_postlist.h.

References pack_chert_postlist_key().

Referenced by get_chunk(), get_collection_freq(), get_termfreq(), merge_changes(), ChertPostList::move_to_chunk_containing(), and term_exists().

void ChertPostListTable::merge_changes ( const map< string, map< Xapian::docid, pair< char, Xapian::termcount > > > &  mod_plists,
const map< Xapian::docid, Xapian::termcount > &  doclens,
const map< string, pair< Xapian::termcount_diff, Xapian::termcount_diff > > &  freq_deltas 
)

bool ChertPostListTable::open ( chert_revision_number_t  revision_  )  [inline]

Open the btree at a given revision.

Like Btree::open, but try to open at the given revision number and fail if that isn't possible.

Parameters:
revision_ - revision number to open.
Returns:
true if table is successfully opened at desired revision; false if table cannot be opened at desired revision (but table is otherwise consistent).
Exceptions:
Xapian::DatabaseCorruptError will be thrown if the table is in a corrupt state.
Xapian::DatabaseOpeningError will be thrown if the table cannot be opened (but is not corrupt - eg, permission problems, not present, etc).

Reimplemented from ChertTable.

Definition at line 72 of file chert_postlist.h.

References doclen_pl, and ChertTable::open().

Referenced by ChertDatabase::open_tables(), and ChertDatabase::open_tables_consistent().

bool ChertPostListTable::term_exists ( const string &  term  )  const [inline]

Definition at line 98 of file chert_postlist.h.

References ChertTable::key_exists(), and make_key().

Referenced by ChertDatabase::term_exists().


Member Data Documentation

AutoPtr<ChertPostList> ChertPostListTable::doclen_pl [mutable, private]

PostList for looking up document lengths.

Definition at line 52 of file chert_postlist.h.

Referenced by document_exists(), get_doclength(), merge_changes(), and open().


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

Documentation for Xapian (version 1.2.9).
Generated on 10 May 2012 by Doxygen 1.5.9.