BrassPostListTable Class Reference

#include <brass_postlist.h>

Inheritance diagram for BrassPostListTable:

Inheritance graph
[legend]
Collaboration diagram for BrassPostListTable:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BrassPostListTable (const string &path_, bool readonly_)
 Create a new table object.
bool open (brass_revision_number_t revno)
 Open the btree at a given revision.
void merge_changes (const string &term, const Inverter::PostingChanges &changes)
 Merge changes for a term.
void merge_doclen_changes (const map< Xapian::docid, Xapian::termcount > &doclens)
 Merge document length changes.
Xapian::docid get_chunk (const string &tname, Xapian::docid did, bool adding, Brass::PostlistChunkReader **from, Brass::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 BrassDatabase > db) const
 Returns the length of document did.
bool document_exists (Xapian::docid did, Xapian::Internal::RefCntPtr< const BrassDatabase > 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< BrassPostListdoclen_pl
 PostList for looking up document lengths.


Detailed Description

Definition at line 51 of file brass_postlist.h.


Constructor & Destructor Documentation

BrassPostListTable::BrassPostListTable ( 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 68 of file brass_postlist.h.


Member Function Documentation

bool BrassPostListTable::document_exists ( Xapian::docid  did,
Xapian::Internal::RefCntPtr< const BrassDatabase db 
) const

Check if document did exists.

Definition at line 74 of file brass_postlist.cc.

References doclen_pl.

Referenced by BrassWritableDatabase::replace_document().

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

Xapian::termcount BrassPostListTable::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 brass_postlist.cc.

References BrassTable::get_exact_entry(), make_key(), and BrassPostList::read_number_of_entries().

Referenced by BrassDatabase::get_collection_freq().

Xapian::termcount BrassPostListTable::get_doclength ( Xapian::docid  did,
Xapian::Internal::RefCntPtr< const BrassDatabase db 
) const

Returns the length of document did.

Definition at line 61 of file brass_postlist.cc.

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

Referenced by BrassDatabase::get_doclength().

Xapian::doccount BrassPostListTable::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 brass_postlist.cc.

References BrassTable::get_exact_entry(), make_key(), and BrassPostList::read_number_of_entries().

Referenced by BrassDatabase::get_termfreq().

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

Compose a key from a termname.

Definition at line 95 of file brass_postlist.h.

References pack_brass_postlist_key().

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

void BrassPostListTable::merge_changes ( const string &  term,
const Inverter::PostingChanges changes 
)

void BrassPostListTable::merge_doclen_changes ( const map< Xapian::docid, Xapian::termcount > &  doclens  ) 

bool BrassPostListTable::open ( brass_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 BrassTable.

Definition at line 73 of file brass_postlist.h.

References doclen_pl, and BrassTable::open().

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

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

Definition at line 99 of file brass_postlist.h.

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

Referenced by BrassDatabase::term_exists().


Member Data Documentation

AutoPtr<BrassPostList> BrassPostListTable::doclen_pl [mutable, private]

PostList for looking up document lengths.

Definition at line 53 of file brass_postlist.h.

Referenced by document_exists(), get_doclength(), merge_doclen_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.