Skip to content

Commit

Permalink
repair a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangShangtong authored and ZhangShangtong committed Jul 21, 2014
1 parent c2526c8 commit bba7d5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 47 deletions.
42 changes: 6 additions & 36 deletions xapian-core/backends/brass/brass_postlist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1586,37 +1586,6 @@ BrassPostList::move_to_chunk_containing(Xapian::docid desired_did)
if (desired_did > last_did_in_chunk) next_chunk();
}

bool
BrassPostList::move_forward_in_chunk_to_at_least(Xapian::docid desired_did)
{
LOGCALL(DB, bool, "BrassPostList::move_forward_in_chunk_to_at_least", desired_did);
bool rtval = p_skip_list_reader->jump_to(desired_did);
did = p_skip_list_reader->get_docid();
wdf = p_skip_list_reader->get_wdf();
is_at_end = p_skip_list_reader->is_at_end();
RETURN(rtval);
/*if (did >= desired_did)
RETURN(true);
if (desired_did <= last_did_in_chunk) {
while (pos != end) {
read_did_increase(&pos, end, &did);
if (did >= desired_did) {
read_wdf(&pos, end, &wdf);
RETURN(true);
}
// It's faster to just skip over the wdf than to decode it.
read_wdf(&pos, end, NULL);
}
// If we hit the end of the chunk then last_did_in_chunk must be wrong.
Assert(false);
}
pos = end;
RETURN(false);*/
}

PostList *
BrassPostList::skip_to(Xapian::docid desired_did, double w_min)
{
Expand All @@ -1643,11 +1612,12 @@ BrassPostList::skip_to(Xapian::docid desired_did, double w_min)
// forward in chunk.
if (is_at_end) RETURN(NULL);
}

// Move to correct position in chunk
bool have_document = move_forward_in_chunk_to_at_least(desired_did);
(void)have_document;
Assert(have_document);

p_skip_list_reader->jump_to(desired_did);
did = p_skip_list_reader->get_docid();
wdf = p_skip_list_reader->get_wdf();
is_at_end = p_skip_list_reader->is_at_end();


if (is_at_end) {
LOGLINE(DB, "Skipped to end");
Expand Down
11 changes: 0 additions & 11 deletions xapian-core/backends/brass/brass_postlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,17 +536,6 @@ class BrassPostList : public LeafPostList {
*/
void move_to_chunk_containing(Xapian::docid desired_did);

/** 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.
*
* @return true if we moved to a valid document,
* false if we reached the end of the chunk.
*/
bool move_forward_in_chunk_to_at_least(Xapian::docid desired_did);

BrassPostList(Xapian::Internal::intrusive_ptr<const BrassDatabase> this_db_,
const string & term,
BrassCursor * cursor_);
Expand Down

0 comments on commit bba7d5b

Please sign in to comment.