xapian-core  2.0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HoneyPostList Class Reference

PostList in a honey database. More...

#include <honey_postlist.h>

+ Inheritance diagram for HoneyPostList:
+ Collaboration diagram for HoneyPostList:

Public Member Functions

 HoneyPostList (const HoneyDatabase *db_, std::string_view term_, HoneyCursor *cursor_)
 Create HoneyPostList from already positioned cursor_. More...
 
 ~HoneyPostList ()
 
bool open_nearby_postlist (std::string_view term_, bool need_read_pos, LeafPostList *&pl) const
 Open another postlist from the same database. More...
 
Xapian::docid get_docid () const
 Return the current docid. More...
 
Xapian::termcount get_wdf () const
 Return the wdf for the document at the current position. More...
 
bool at_end () const
 Return true if the current position is past the last entry in this list. More...
 
PositionListopen_position_list () const
 Read the position list for the term in the current document and return a pointer to it (not owned by the PostList). More...
 
PostListnext (double w_min)
 Advance the current position to the next document in the postlist. More...
 
PostListskip_to (Xapian::docid did, double w_min)
 Skip forward to the specified docid. More...
 
Xapian::termcount get_wdf_upper_bound () const
 
void get_docid_range (Xapian::docid &first, Xapian::docid &last) const
 Get the bounds on the range of docids this PostList can return. More...
 
std::string get_description () const
 Return a string description of this object. More...
 
- Public Member Functions inherited from LeafPostList
 ~LeafPostList ()
 
Xapian::termcount get_collfreq () const
 Get the collection frequency of the term. More...
 
void set_termweight (const Xapian::Weight *weight_)
 Set the weighting scheme to use during matching. More...
 
double resolve_lazy_termweight (Xapian::Weight *weight_, Xapian::Weight::Internal *stats, Xapian::termcount qlen, Xapian::termcount wqf, double factor, const Xapian::Database::Internal *shard)
 
double get_weight (Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const
 Return the weight contribution for the current position. More...
 
double recalc_maxweight ()
 Recalculate the upper bound on what get_weight() can return. More...
 
Xapian::termcount count_matching_subqs () const
 Count the number of leaf subqueries which match at the current position. More...
 
void gather_position_lists (OrPositionList *orposlist)
 Gather PositionList* objects for a subtree. More...
 
const std::string & get_term () const
 Get the term name. More...
 
void set_term (std::string_view term_)
 Set the term name. More...
 
- Public Member Functions inherited from Xapian::Internal::PostList
virtual ~PostList ()
 We have virtual methods and want to be able to delete derived classes using a pointer to the base class, so we need a virtual destructor. More...
 
Xapian::doccount get_termfreq () const
 Get an estimate of the number of documents this PostList will return. More...
 
virtual PositionListread_position_list ()
 Read the position list for the term in the current document and return a pointer to it (owned by the PostList). More...
 
virtual PostListcheck (Xapian::docid did, double w_min, bool &valid)
 Check if the specified docid occurs in this postlist. More...
 
PostListnext ()
 Advance the current position to the next document in the postlist. More...
 
PostListskip_to (Xapian::docid did)
 Skip forward to the specified docid. More...
 

Private Member Functions

HoneyPostListoperator= (const HoneyPostList &)=delete
 Don't allow assignment. More...
 
 HoneyPostList (const HoneyPostList &)=delete
 Don't allow copying. More...
 
bool update_reader ()
 Update reader to use the chunk currently pointed to by cursor. More...
 

Private Attributes

HoneyCursorcursor
 Cursor on the postlist table. More...
 
Honey::PostingChunkReader reader
 
Xapian::docid last_did
 The highest document id in this posting list. More...
 
const HoneyDatabasedb
 HoneyDatabase to get position table object from. More...
 
Xapian::termcount wdf_max
 Maximum wdf for this postlist. More...
 
bool started = false
 Needed so that first next() does nothing. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LeafPostList
 LeafPostList (std::string_view term_)
 Only constructable as a base class for derived classes. More...
 
- Protected Member Functions inherited from Xapian::Internal::PostList
 PostList ()
 Only constructable as a base class for derived classes. More...
 
- Protected Attributes inherited from LeafPostList
const Xapian::Weightweight = nullptr
 
std::string term
 The term name for this postlist (empty for an alldocs postlist). More...
 
Xapian::termcount collfreq
 The collection frequency of the term. More...
 
- Protected Attributes inherited from Xapian::Internal::PostList
Xapian::doccount termfreq
 Estimate of the number of documents this PostList will return. More...
 

Detailed Description

PostList in a honey database.

Definition at line 153 of file honey_postlist.h.

Constructor & Destructor Documentation

◆ HoneyPostList() [1/2]

HoneyPostList::HoneyPostList ( const HoneyPostList )
privatedelete

Don't allow copying.

Referenced by open_nearby_postlist().

◆ HoneyPostList() [2/2]

HoneyPostList::HoneyPostList ( const HoneyDatabase db_,
std::string_view  term_,
HoneyCursor cursor_ 
)

◆ ~HoneyPostList()

HoneyPostList::~HoneyPostList ( )

Definition at line 117 of file honey_postlist.cc.

References cursor.

Member Function Documentation

◆ at_end()

bool HoneyPostList::at_end ( ) const
virtual

Return true if the current position is past the last entry in this list.

Implements Xapian::Internal::PostList.

Definition at line 158 of file honey_postlist.cc.

References cursor.

◆ get_description()

string HoneyPostList::get_description ( ) const
virtual

Return a string description of this object.

Implements Xapian::Internal::PostList.

Reimplemented in HoneyPosPostList.

Definition at line 264 of file honey_postlist.cc.

References LeafPostList::term.

◆ get_docid()

Xapian::docid HoneyPostList::get_docid ( ) const
virtual

Return the current docid.

Implements Xapian::Internal::PostList.

Definition at line 146 of file honey_postlist.cc.

References Honey::PostingChunkReader::get_docid(), and reader.

Referenced by open_position_list(), and HoneyPosPostList::read_position_list().

◆ get_docid_range()

void HoneyPostList::get_docid_range ( Xapian::docid first,
Xapian::docid last 
) const
virtual

Get the bounds on the range of docids this PostList can return.

Parameters
[out]firstSet to a lower bound on the docids that can be returned, or not changed if there's no known lower bound (other than 1).
[out]lastSet to an upper bound on the docids that can be returned, or not changed if there's no known upper bound (other than the highest used docid).

The default implementation (PostList::get_docid_range()) does nothing, which is suitable when there's no known lower or upper bound.

Reimplemented from Xapian::Internal::PostList.

Definition at line 251 of file honey_postlist.cc.

References Assert, AssertRel, Honey::PostingChunkReader::get_docid(), last_did, reader, started, and Xapian::Internal::PostList::termfreq.

◆ get_wdf()

Xapian::termcount HoneyPostList::get_wdf ( ) const
virtual

Return the wdf for the document at the current position.

The default implementation throws Xapian::UnimplementedError.

Reimplemented from Xapian::Internal::PostList.

Definition at line 152 of file honey_postlist.cc.

References Honey::PostingChunkReader::get_wdf(), and reader.

◆ get_wdf_upper_bound()

Xapian::termcount HoneyPostList::get_wdf_upper_bound ( ) const
virtual

Implements LeafPostList.

Definition at line 245 of file honey_postlist.cc.

References wdf_max.

◆ next()

PostList * HoneyPostList::next ( double  w_min)
virtual

Advance the current position to the next document in the postlist.

The list starts before the first entry in the list, so next(), skip_to() or check() must be called before any methods which need the context of the current position.

Parameters
w_minThe minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore).
Returns
If a non-NULL pointer is returned, then the caller should substitute the returned pointer for its pointer to us, and then delete us. This "pruning" can only happen for a non-leaf subclass of this class.

Implements Xapian::Internal::PostList.

Definition at line 170 of file honey_postlist.cc.

References Assert, Honey::PostingChunkReader::at_end(), cursor, Honey::PostingChunkReader::get_docid(), last_did, HoneyCursor::next(), Honey::PostingChunkReader::next(), rare, reader, started, and update_reader().

◆ open_nearby_postlist()

bool HoneyPostList::open_nearby_postlist ( std::string_view  term_,
bool  need_read_pos,
LeafPostList *&  pl 
) const
virtual

Open another postlist from the same database.

Parameters
term_The term to open a postlist for (must not be an empty string). If term_ is near to this postlist's term, then this can be a lot more efficient (and if it isn't very near, there's not much of a penalty). Using this method can make a wildcard expansion much more memory efficient.
need_read_posDoes the postlist need to support read_position_list()? Note that open_position_list() may still be called even if need_read_pos is false.
[out]plIf true is returned, set to a new LeafPostList object (or may be set to NULL if the term doesn't index any documents). The caller takes ownership of the returned object.
Returns
true if successful (and pl has been set); false if not (in which case the caller should probably open the postlist via the database instead).

Reimplemented from LeafPostList.

Definition at line 123 of file honey_postlist.cc.

References Assert, cursor, db, HoneyPostList(), and Honey::make_postingchunk_key().

◆ open_position_list()

PositionList * HoneyPostList::open_position_list ( ) const
virtual

Read the position list for the term in the current document and return a pointer to it (not owned by the PostList).

The default implementation throws Xapian::UnimplementedError.

Reimplemented from Xapian::Internal::PostList.

Definition at line 164 of file honey_postlist.cc.

References db, get_docid(), HoneyPositionTable::open_position_list(), HoneyDatabase::position_table, and LeafPostList::term.

◆ operator=()

HoneyPostList& HoneyPostList::operator= ( const HoneyPostList )
privatedelete

Don't allow assignment.

◆ skip_to()

PostList * HoneyPostList::skip_to ( Xapian::docid  did,
double  w_min 
)
virtual

Skip forward to the specified docid.

If the specified docid isn't in the list, position ourselves on the first document after it (or at_end() if no greater docids are present).

Parameters
w_minThe minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore).
Returns
If a non-NULL pointer is returned, then the caller should substitute the returned pointer for its pointer to us, and then delete us. This "pruning" can only happen for a non-leaf subclass of this class.

Implements Xapian::Internal::PostList.

Definition at line 200 of file honey_postlist.cc.

References HoneyCursor::after_end(), Assert, Honey::PostingChunkReader::at_end(), cursor, HoneyCursor::find_entry_ge(), last_did, Honey::make_postingchunk_key(), rare, reader, Honey::PostingChunkReader::skip_to(), started, LeafPostList::term, and update_reader().

◆ update_reader()

bool HoneyPostList::update_reader ( )
private

Update reader to use the chunk currently pointed to by cursor.

Definition at line 39 of file honey_postlist.cc.

References Honey::docid_from_key(), and term.

Referenced by next(), and skip_to().

Member Data Documentation

◆ cursor

HoneyCursor* HoneyPostList::cursor
private

Cursor on the postlist table.

Definition at line 161 of file honey_postlist.h.

Referenced by at_end(), HoneyPostList(), next(), open_nearby_postlist(), skip_to(), and ~HoneyPostList().

◆ db

const HoneyDatabase* HoneyPostList::db
private

HoneyDatabase to get position table object from.

Definition at line 169 of file honey_postlist.h.

Referenced by open_nearby_postlist(), and open_position_list().

◆ last_did

Xapian::docid HoneyPostList::last_did
private

The highest document id in this posting list.

Definition at line 166 of file honey_postlist.h.

Referenced by get_docid_range(), HoneyPostList(), next(), and skip_to().

◆ reader

Honey::PostingChunkReader HoneyPostList::reader
private

Definition at line 163 of file honey_postlist.h.

Referenced by get_docid(), get_docid_range(), get_wdf(), HoneyPostList(), next(), and skip_to().

◆ started

bool HoneyPostList::started = false
private

Needed so that first next() does nothing.

FIXME: Can we arrange not to need this?

Definition at line 181 of file honey_postlist.h.

Referenced by get_docid_range(), next(), and skip_to().

◆ wdf_max

Xapian::termcount HoneyPostList::wdf_max
private

Maximum wdf for this postlist.

We store this for honey, so it's exact - not just an upper bound.

Definition at line 175 of file honey_postlist.h.

Referenced by get_wdf_upper_bound(), and HoneyPostList().


The documentation for this class was generated from the following files: