xapian-core  2.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
LeafPostList Class Referenceabstract

Abstract base class for leaf postlists. More...

#include <leafpostlist.h>

+ Inheritance diagram for LeafPostList:
+ Collaboration diagram for LeafPostList:

Public Member Functions

 ~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...
 
virtual bool open_nearby_postlist (std::string_view term_, bool need_read_pos, LeafPostList *&pl) const
 Open another postlist from the same database. More...
 
virtual Xapian::termcount get_wdf_upper_bound () const =0
 
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 Xapian::docid get_docid () const =0
 Return the current docid. More...
 
virtual Xapian::termcount get_wdf () const
 Return the wdf for the document at the current position. More...
 
virtual bool at_end () const =0
 Return true if the current position is past the last entry in this list. 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 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...
 
virtual PostListnext (double w_min)=0
 Advance the current position to the next document in the postlist. More...
 
virtual PostListskip_to (Xapian::docid did, double w_min)=0
 Skip forward to the specified docid. 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...
 
virtual void get_docid_range (docid &first, docid &last) const
 Get the bounds on the range of docids this PostList can return. More...
 
virtual std::string get_description () const =0
 Return a string description of this object. More...
 

Protected Member Functions

 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

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...
 

Private Member Functions

void operator= (const LeafPostList &)=delete
 Don't allow assignment. More...
 
 LeafPostList (const LeafPostList &)=delete
 Don't allow copying. More...
 

Detailed Description

Abstract base class for leaf postlists.

This class provides the following features in addition to the PostList class:

Definition at line 40 of file leafpostlist.h.

Constructor & Destructor Documentation

◆ LeafPostList() [1/2]

LeafPostList::LeafPostList ( const LeafPostList )
privatedelete

Don't allow copying.

◆ LeafPostList() [2/2]

LeafPostList::LeafPostList ( std::string_view  term_)
inlineexplicitprotected

Only constructable as a base class for derived classes.

Definition at line 60 of file leafpostlist.h.

◆ ~LeafPostList()

LeafPostList::~LeafPostList ( )

Definition at line 33 of file leafpostlist.cc.

Member Function Documentation

◆ count_matching_subqs()

Xapian::termcount LeafPostList::count_matching_subqs ( ) const
virtual

Count the number of leaf subqueries which match at the current position.

Reimplemented from Xapian::Internal::PostList.

Definition at line 57 of file leafpostlist.cc.

◆ gather_position_lists()

void LeafPostList::gather_position_lists ( OrPositionList orposlist)
virtual

Gather PositionList* objects for a subtree.

Reimplemented from Xapian::Internal::PostList.

Definition at line 63 of file leafpostlist.cc.

References OrPositionList::add_poslist().

◆ get_collfreq()

Xapian::termcount LeafPostList::get_collfreq ( ) const
inline

Get the collection frequency of the term.

This is the sum of wdf values for the term in all documents.

Definition at line 70 of file leafpostlist.h.

References collfreq.

Referenced by LocalSubMatch::register_lazy_postlist_for_stats().

◆ get_term()

const std::string& LeafPostList::get_term ( ) const
inline

Get the term name.

Definition at line 148 of file leafpostlist.h.

References term.

Referenced by LocalSubMatch::register_lazy_postlist_for_stats().

◆ get_wdf_upper_bound()

virtual Xapian::termcount LeafPostList::get_wdf_upper_bound ( ) const
pure virtual

◆ get_weight()

double LeafPostList::get_weight ( Xapian::termcount  doclen,
Xapian::termcount  unique_terms,
Xapian::termcount  wdfdocmax 
) const
virtual

Return the weight contribution for the current position.

Implements Xapian::Internal::PostList.

Definition at line 39 of file leafpostlist.cc.

References AssertRel.

◆ open_nearby_postlist()

bool LeafPostList::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 in HoneyPostList, and GlassPostList.

Definition at line 69 of file leafpostlist.cc.

Referenced by LocalSubMatch::open_post_list().

◆ operator=()

void LeafPostList::operator= ( const LeafPostList )
privatedelete

Don't allow assignment.

◆ recalc_maxweight()

double LeafPostList::recalc_maxweight ( )
virtual

Recalculate the upper bound on what get_weight() can return.

The maximum weight that get_weight() can return can decrease as the match progresses (typically when the PostList tree prunes) - calling this method calculates a current upper bound.

Note that this method may be called after the postlist has reached the end. In this situation, the method should return 0.

Implements Xapian::Internal::PostList.

Definition at line 51 of file leafpostlist.cc.

◆ resolve_lazy_termweight()

double LeafPostList::resolve_lazy_termweight ( Xapian::Weight weight_,
Xapian::Weight::Internal stats,
Xapian::termcount  qlen,
Xapian::termcount  wqf,
double  factor,
const Xapian::Database::Internal shard 
)
inline

◆ set_term()

void LeafPostList::set_term ( std::string_view  term_)
inline

Set the term name.

This is used when we optimise a term matching all documents to an all documents postlist so that postlist reports the correct termname.

Definition at line 155 of file leafpostlist.h.

References term.

Referenced by LocalSubMatch::open_post_list().

◆ set_termweight()

void LeafPostList::set_termweight ( const Xapian::Weight weight_)
inline

Set the weighting scheme to use during matching.

If this isn't called, get_weight() and recalc_maxweight() will both return 0.

You should not call this more than once on a particular object.

Parameters
weight_The weighting object to use. Must not be NULL.

Definition at line 81 of file leafpostlist.h.

References Assert, and weight.

Referenced by LocalSubMatch::open_post_list().

Member Data Documentation

◆ collfreq

Xapian::termcount LeafPostList::collfreq
protected

The collection frequency of the term.

This is the sum of wdf values for the term in all documents.

Definition at line 57 of file leafpostlist.h.

Referenced by get_collfreq(), HoneyPostList::HoneyPostList(), GlassPostList::init(), and InMemoryPostList::InMemoryPostList().

◆ term

std::string LeafPostList::term
protected

◆ weight

const Xapian::Weight* LeafPostList::weight = nullptr
protected

Definition at line 48 of file leafpostlist.h.

Referenced by resolve_lazy_termweight(), and set_termweight().


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