#include <brass_postlist.h>


Public Member Functions | |
| BrassPostList (Xapian::Internal::RefCntPtr< const BrassDatabase > this_db_, const string &term, bool keep_reference) | |
| Default constructor. | |
| ~BrassPostList () | |
| Destructor. | |
| bool | jump_to (Xapian::docid desired_did) |
| Used for looking up doclens. | |
| Xapian::doccount | get_termfreq () const |
| Returns number of docs indexed by this term. | |
| Xapian::docid | get_docid () const |
| Returns the current docid. | |
| Xapian::termcount | get_doclength () const |
| Returns the length of current document. | |
| Xapian::termcount | get_wdf () const |
| Returns the Within Document Frequency of the term in the current document. | |
| PositionList * | read_position_list () |
| Get the list of positions of the term in the current document. | |
| PositionList * | open_position_list () const |
| Get the list of positions of the term in the current document. | |
| PostList * | next (Xapian::weight w_min) |
| Move to the next document. | |
| PostList * | skip_to (Xapian::docid desired_did, Xapian::weight w_min) |
| Skip to next document with docid >= docid. | |
| bool | at_end () const |
| Return true if and only if we're off the end of the list. | |
| std::string | get_description () const |
| Get a description of the document. | |
Static Public Member Functions | |
| static void | read_number_of_entries (const char **posptr, const char *end, Xapian::doccount *number_of_entries_ptr, Xapian::termcount *collection_freq_ptr) |
| Read the number of entries and the collection frequency. | |
Protected Attributes | |
| Xapian::Internal::RefCntPtr < const BrassDatabase > | this_db |
| The database we are searching. | |
| BrassPositionList | positionlist |
| The position list object for this posting list. | |
| bool | have_started |
| Whether we've started reading the list yet. | |
Private Member Functions | |
| BrassPostList (const BrassPostList &) | |
| Copying is not allowed. | |
| void | operator= (const BrassPostList &) |
| Assignment is not allowed. | |
| bool | next_in_chunk () |
| Move to the next item in the chunk, if possible. | |
| void | next_chunk () |
| Move to the next chunk. | |
| bool | current_chunk_contains (Xapian::docid desired_did) |
| Return true if the given document ID lies in the range covered by the current chunk. | |
| void | move_to_chunk_containing (Xapian::docid desired_did) |
| Move to chunk containing the specified document ID. | |
| bool | move_forward_in_chunk_to_at_least (Xapian::docid desired_did) |
| Scan forward in the current chunk for the specified document ID. | |
Private Attributes | |
| bool | is_last_chunk |
| True if this is the last chunk. | |
| bool | is_at_end |
| Whether we've run off the end of the list yet. | |
| AutoPtr< BrassCursor > | cursor |
| Cursor pointing to current chunk of postlist. | |
| Xapian::docid | first_did_in_chunk |
| The first document id in this chunk. | |
| Xapian::docid | last_did_in_chunk |
| The last document id in this chunk. | |
| const char * | pos |
| Position of iteration through current chunk. | |
| const char * | end |
| Pointer to byte after end of current chunk. | |
| Xapian::docid | did |
| Document id we're currently at. | |
| Xapian::termcount | wdf |
| The wdf of the current document. | |
| Xapian::doccount | number_of_entries |
| The number of entries in the posting list. | |
Definition at line 126 of file brass_postlist.h.
| BrassPostList::BrassPostList | ( | const BrassPostList & | ) | [private] |
Copying is not allowed.
| BrassPostList::BrassPostList | ( | Xapian::Internal::RefCntPtr< const BrassDatabase > | this_db_, | |
| const string & | term_, | |||
| bool | keep_reference | |||
| ) |
Default constructor.
The format of a postlist is:.
Split into chunks. Key for first chunk is the termname (encoded as length : name). Key for subsequent chunks is the same, followed by the document ID of the first document in the chunk (encoded as length of representation in first byte, and then docid).
A chunk (except for the first chunk) contains:
1) bool - true if this is the last chunk. 2) difference between final docid in chunk and first docid. 3) wdf for the first item. 4) increment in docid to next item, followed by wdf for the item. 5) (4) repeatedly.
The first chunk begins with the number of entries, the collection frequency, then the docid of the first document, then has the header of a standard chunk.
Definition at line 674 of file brass_postlist.cc.
References cursor, did, end, first_did_in_chunk, Xapian::Internal::RefCntPtr< T >::get(), is_at_end, is_last_chunk, last_did_in_chunk, LOGCALL_VOID, LOGLINE, make_key(), number_of_entries, pos, read_start_of_chunk(), read_start_of_first_chunk(), read_wdf(), LeafPostList::term, and wdf.
| BrassPostList::~BrassPostList | ( | ) |
| bool BrassPostList::at_end | ( | ) | const [inline, virtual] |
Return true if and only if we're off the end of the list.
Implements Xapian::PostingIterator::Internal.
Definition at line 269 of file brass_postlist.h.
References is_at_end.
Referenced by BrassAllDocsPostList::get_wdf().
| bool BrassPostList::current_chunk_contains | ( | Xapian::docid | desired_did | ) | [private] |
Return true if the given document ID lies in the range covered by the current chunk.
This does not say whether the document ID is actually present. It will return false if the document ID is greater than the last document ID in the chunk, even if it is less than the first document ID in the next chunk: it is possible for no chunk to contain a particular document ID.
Definition at line 824 of file brass_postlist.cc.
References first_did_in_chunk, last_did_in_chunk, LOGCALL, and RETURN.
| string BrassPostList::get_description | ( | ) | const [virtual] |
Get a description of the document.
Implements Xapian::PostingIterator::Internal.
Reimplemented in BrassAllDocsPostList.
Definition at line 973 of file brass_postlist.cc.
References number_of_entries, Xapian::Internal::str(), and LeafPostList::term.
| Xapian::docid BrassPostList::get_docid | ( | ) | const [inline, virtual] |
Returns the current docid.
Implements Xapian::PostingIterator::Internal.
Definition at line 244 of file brass_postlist.h.
References Assert, did, and have_started.
Referenced by BrassAllDocsPostList::get_description().
| Xapian::termcount BrassPostList::get_doclength | ( | ) | const [virtual] |
Returns the length of current document.
Implements Xapian::PostingIterator::Internal.
Reimplemented in BrassAllDocsPostList.
Definition at line 714 of file brass_postlist.cc.
References Assert, did, Xapian::Internal::RefCntPtr< T >::get(), have_started, LOGCALL, RETURN, and this_db.
| Xapian::doccount BrassPostList::get_termfreq | ( | ) | const [inline, virtual] |
Returns number of docs indexed by this term.
This is the length of the postlist.
Implements LeafPostList.
Reimplemented in BrassAllDocsPostList.
Definition at line 241 of file brass_postlist.h.
References number_of_entries.
| Xapian::termcount BrassPostList::get_wdf | ( | ) | const [inline, virtual] |
Returns the Within Document Frequency of the term in the current document.
Reimplemented from Xapian::PostingIterator::Internal.
Reimplemented in BrassAllDocsPostList.
Definition at line 252 of file brass_postlist.h.
References Assert, have_started, and wdf.
Referenced by BrassAllDocsPostList::get_doclength().
| bool BrassPostList::jump_to | ( | Xapian::docid | desired_did | ) |
Used for looking up doclens.
Definition at line 944 of file brass_postlist.cc.
References current_chunk_contains(), did, have_started, is_at_end, LOGCALL, move_forward_in_chunk_to_at_least(), move_to_chunk_containing(), pos, and RETURN.
| bool BrassPostList::move_forward_in_chunk_to_at_least | ( | Xapian::docid | desired_did | ) | [private] |
Scan forward in the current chunk for the specified document ID.
This is particularly efficient if the desired document ID is greater than the last in the chunk - it then skips straight to the end.
Definition at line 883 of file brass_postlist.cc.
References Assert, did, end, last_did_in_chunk, LOGCALL, pos, read_did_increase(), read_wdf(), RETURN, and wdf.
| void BrassPostList::move_to_chunk_containing | ( | Xapian::docid | desired_did | ) | [private] |
Move to chunk containing the specified document ID.
This moves to the chunk whose starting document ID is <= desired_did, but such that the next chunk's starting document ID is > desired_did.
It is thus possible that current_chunk_contains(desired_did) will return false after this call, since the document ID might lie after the end of this chunk, but before the start of the next chunk.
Definition at line 835 of file brass_postlist.cc.
References Assert, check_tname_in_key_lite(), cursor, did, end, first_did_in_chunk, is_at_end, is_last_chunk, last_did_in_chunk, LOGCALL_VOID, BrassPostListTable::make_key(), next_chunk(), number_of_entries, pos, read_start_of_chunk(), read_start_of_first_chunk(), read_wdf(), report_read_error(), LeafPostList::term, unpack_uint_preserving_sort(), and wdf.
| PostList * BrassPostList::next | ( | Xapian::weight | w_min | ) | [virtual] |
Move to the next document.
Implements Xapian::PostingIterator::Internal.
Definition at line 803 of file brass_postlist.cc.
References did, have_started, is_at_end, LOGCALL, LOGLINE, next_chunk(), next_in_chunk(), RETURN, and wdf.
| void BrassPostList::next_chunk | ( | ) | [private] |
Move to the next chunk.
If there are no more chunks in this postlist, this will set is_at_end to true.
Definition at line 740 of file brass_postlist.cc.
References check_tname_in_key_lite(), cursor, did, end, first_did_in_chunk, is_at_end, is_last_chunk, last_did_in_chunk, LOGCALL_VOID, pos, read_start_of_chunk(), read_wdf(), report_read_error(), Xapian::Internal::str(), LeafPostList::term, unpack_uint_preserving_sort(), and wdf.
Referenced by move_to_chunk_containing(), and next().
| bool BrassPostList::next_in_chunk | ( | ) | [private] |
Move to the next item in the chunk, if possible.
If already at the end of the chunk, returns false.
Definition at line 723 of file brass_postlist.cc.
References Assert, did, end, last_did_in_chunk, LOGCALL, pos, read_did_increase(), read_wdf(), RETURN, and wdf.
Referenced by next().
| PositionList * BrassPostList::open_position_list | ( | ) | const [virtual] |
Get the list of positions of the term in the current document.
Reimplemented from Xapian::PostingIterator::Internal.
Reimplemented in BrassAllDocsPostList.
Definition at line 795 of file brass_postlist.cc.
References Assert, did, Xapian::Internal::RefCntPtr< T >::get(), LOGCALL, RETURN, LeafPostList::term, and this_db.
| void BrassPostList::operator= | ( | const BrassPostList & | ) | [private] |
Assignment is not allowed.
| void BrassPostList::read_number_of_entries | ( | const char ** | posptr, | |
| const char * | end, | |||
| Xapian::doccount * | number_of_entries_ptr, | |||
| Xapian::termcount * | collection_freq_ptr | |||
| ) | [static] |
Read the number of entries and the collection frequency.
Read the number of entries in the posting list.
This must only be called when *posptr is pointing to the start of the first chunk of the posting list.
Definition at line 644 of file brass_postlist.cc.
References report_read_error(), and unpack_uint().
Referenced by BrassPostListTable::get_collection_freq(), BrassPostListTable::get_termfreq(), read_start_of_first_chunk(), and BrassAllTermsList::read_termfreq_and_collfreq().
| PositionList * BrassPostList::read_position_list | ( | ) | [virtual] |
Get the list of positions of the term in the current document.
Reimplemented from Xapian::PostingIterator::Internal.
Reimplemented in BrassAllDocsPostList.
Definition at line 786 of file brass_postlist.cc.
References Assert, did, Xapian::Internal::RefCntPtr< T >::get(), LOGCALL, positionlist, BrassPositionList::read_data(), RETURN, LeafPostList::term, and this_db.
| PostList * BrassPostList::skip_to | ( | Xapian::docid | desired_did, | |
| Xapian::weight | w_min | |||
| ) | [virtual] |
Skip to next document with docid >= docid.
Implements Xapian::PostingIterator::Internal.
Definition at line 909 of file brass_postlist.cc.
References Assert, current_chunk_contains(), did, have_started, is_at_end, LOGCALL, LOGLINE, move_forward_in_chunk_to_at_least(), move_to_chunk_containing(), RETURN, and wdf.
AutoPtr<BrassCursor> BrassPostList::cursor [private] |
Cursor pointing to current chunk of postlist.
Definition at line 148 of file brass_postlist.h.
Referenced by BrassPostList(), move_to_chunk_containing(), and next_chunk().
Xapian::docid BrassPostList::did [private] |
Document id we're currently at.
Definition at line 163 of file brass_postlist.h.
Referenced by BrassPostList(), get_docid(), get_doclength(), jump_to(), move_forward_in_chunk_to_at_least(), move_to_chunk_containing(), next(), next_chunk(), next_in_chunk(), open_position_list(), read_position_list(), and skip_to().
const char* BrassPostList::end [private] |
Pointer to byte after end of current chunk.
Definition at line 160 of file brass_postlist.h.
Referenced by BrassPostList(), move_forward_in_chunk_to_at_least(), move_to_chunk_containing(), next_chunk(), and next_in_chunk().
The first document id in this chunk.
Definition at line 151 of file brass_postlist.h.
Referenced by BrassPostList(), current_chunk_contains(), move_to_chunk_containing(), and next_chunk().
bool BrassPostList::have_started [protected] |
Whether we've started reading the list yet.
Definition at line 138 of file brass_postlist.h.
Referenced by get_docid(), get_doclength(), get_wdf(), jump_to(), next(), and skip_to().
bool BrassPostList::is_at_end [private] |
Whether we've run off the end of the list yet.
Definition at line 145 of file brass_postlist.h.
Referenced by at_end(), BrassPostList(), jump_to(), move_to_chunk_containing(), next(), next_chunk(), and skip_to().
bool BrassPostList::is_last_chunk [private] |
True if this is the last chunk.
Definition at line 142 of file brass_postlist.h.
Referenced by BrassPostList(), move_to_chunk_containing(), and next_chunk().
The last document id in this chunk.
Definition at line 154 of file brass_postlist.h.
Referenced by BrassPostList(), current_chunk_contains(), move_forward_in_chunk_to_at_least(), move_to_chunk_containing(), next_chunk(), and next_in_chunk().
The number of entries in the posting list.
Definition at line 169 of file brass_postlist.h.
Referenced by BrassPostList(), get_description(), get_termfreq(), and move_to_chunk_containing().
const char* BrassPostList::pos [private] |
Position of iteration through current chunk.
Definition at line 157 of file brass_postlist.h.
Referenced by BrassPostList(), jump_to(), move_forward_in_chunk_to_at_least(), move_to_chunk_containing(), next_chunk(), and next_in_chunk().
BrassPositionList BrassPostList::positionlist [protected] |
The position list object for this posting list.
Definition at line 135 of file brass_postlist.h.
Referenced by read_position_list().
Xapian::Internal::RefCntPtr<const BrassDatabase> BrassPostList::this_db [protected] |
The database we are searching.
This pointer is held so that the database doesn't get deleted before us, and also to give us access to the position_table.
Definition at line 132 of file brass_postlist.h.
Referenced by get_doclength(), open_position_list(), and read_position_list().
Xapian::termcount BrassPostList::wdf [private] |
The wdf of the current document.
Definition at line 166 of file brass_postlist.h.
Referenced by BrassPostList(), get_wdf(), move_forward_in_chunk_to_at_least(), move_to_chunk_containing(), next(), next_chunk(), next_in_chunk(), and skip_to().