#include <brass_postlist.h>


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< BrassPostList > | doclen_pl |
| PostList for looking up document lengths. | |
Definition at line 51 of file brass_postlist.h.
| 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.
| 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.
| 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 | |||
| ) |
Definition at line 980 of file brass_postlist.cc.
References Assert, check_tname_in_key(), BrassTable::cursor_get(), LOGCALL, LOGVALUE, make_key(), read_start_of_chunk(), read_start_of_first_chunk(), report_read_error(), RETURN, and unpack_uint_preserving_sort().
Referenced by merge_changes(), and merge_doclen_changes().
| 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] |
Compose a key from a termname and docid.
Definition at line 90 of file brass_postlist.h.
References pack_brass_postlist_key().
Referenced by get_chunk(), get_collection_freq(), get_termfreq(), merge_changes(), merge_doclen_changes(), BrassPostList::move_to_chunk_containing(), and term_exists().
| void BrassPostListTable::merge_changes | ( | const string & | term, | |
| const Inverter::PostingChanges & | changes | |||
| ) |
Merge changes for a term.
Definition at line 1132 of file brass_postlist.cc.
References BrassTable::add(), Brass::PostlistChunkWriter::append(), Assert, check_tname_in_key_lite(), BrassCursor::current_key, MutableBrassCursor::del(), BrassTable::del(), BrassCursor::find_entry(), Brass::PostlistChunkWriter::flush(), Inverter::PostingChanges::get_cfdelta(), get_chunk(), Brass::PostlistChunkReader::get_docid(), BrassTable::get_exact_entry(), Inverter::PostingChanges::get_tfdelta(), Brass::PostlistChunkReader::get_wdf(), Brass::PostlistChunkReader::is_at_end(), LOGLINE, make_key(), make_start_of_chunk(), make_start_of_first_chunk(), Brass::PostlistChunkReader::next(), Inverter::PostingChanges::pl_changes, read_start_of_chunk(), and read_start_of_first_chunk().
Referenced by Inverter::flush_all_post_lists(), Inverter::flush_post_list(), and Inverter::flush_post_lists().
| void BrassPostListTable::merge_doclen_changes | ( | const map< Xapian::docid, Xapian::termcount > & | doclens | ) |
Merge document length changes.
Definition at line 1064 of file brass_postlist.cc.
References BrassTable::add(), Brass::PostlistChunkWriter::append(), Assert, doclen_pl, Brass::PostlistChunkWriter::flush(), get_chunk(), Brass::PostlistChunkReader::get_docid(), Brass::PostlistChunkReader::get_wdf(), Brass::PostlistChunkReader::is_at_end(), BrassTable::key_exists(), LOGCALL_VOID, LOGLINE, LOGVALUE, make_key(), make_start_of_chunk(), make_start_of_first_chunk(), and Brass::PostlistChunkReader::next().
Referenced by Inverter::flush_doclengths().
| 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.
| revision_ | - revision number to open. |
| 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().
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().