#include <chert_postlist.h>


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< ChertPostList > | doclen_pl |
| PostList for looking up document lengths. | |
Definition at line 50 of file chert_postlist.h.
| 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.
| 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.
| 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 | |||
| ) |
Definition at line 980 of file chert_postlist.cc.
References Assert, check_tname_in_key(), ChertTable::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().
| 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 | |||
| ) |
Merge added, removed, and changed entries.
Definition at line 1061 of file chert_postlist.cc.
References ChertTable::add(), Chert::PostlistChunkWriter::append(), Assert, check_tname_in_key_lite(), ChertCursor::current_key, MutableChertCursor::del(), ChertTable::del(), doclen_pl, ChertCursor::find_entry(), Chert::PostlistChunkWriter::flush(), get_chunk(), Chert::PostlistChunkReader::get_docid(), ChertTable::get_exact_entry(), Chert::PostlistChunkReader::get_wdf(), Chert::PostlistChunkReader::is_at_end(), ChertTable::key_exists(), LOGCALL_VOID, LOGLINE, LOGVALUE, make_key(), make_start_of_chunk(), make_start_of_first_chunk(), Chert::PostlistChunkReader::next(), read_start_of_chunk(), and read_start_of_first_chunk().
Referenced by ChertWritableDatabase::flush_postlist_changes().
| 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.
| 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 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().
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().