xapian-core  1.4.26
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 ()
 
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)
 
virtual Xapian::doccount get_termfreq () const =0
 Return the exact term frequency. More...
 
Xapian::doccount get_termfreq_min () const
 Get a lower bound on the number of documents indexed by this term. More...
 
Xapian::doccount get_termfreq_max () const
 Get an upper bound on the number of documents indexed by this term. More...
 
Xapian::doccount get_termfreq_est () const
 Get an estimate of the number of documents indexed by this term. More...
 
double get_maxweight () const
 Return an upper bound on what get_weight() can return. More...
 
double get_weight () const
 Return the weight contribution for the current position. More...
 
double recalc_maxweight ()
 Recalculate the upper bound on what get_weight() can return. More...
 
TermFreqs get_termfreq_est_using_stats (const Xapian::Weight::Internal &stats) const
 Get an estimate for the termfreq and reltermfreq, given the stats. 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 LeafPostListopen_nearby_postlist (const std::string &term_) const
 Open another postlist from the same database. More...
 
virtual Xapian::termcount get_wdf_upper_bound () const =0
 
void set_term (const std::string &term_)
 Set the term name. More...
 
- Public Member Functions inherited from Xapian::PostingIterator::Internal
virtual ~Internal ()
 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...
 
virtual Xapian::docid get_docid () const =0
 Return the current docid. More...
 
virtual Xapian::termcount get_doclength () const =0
 Return the length of current document. More...
 
virtual Xapian::termcount get_unique_terms () const =0
 Return the number of unique terms in the current document. More...
 
virtual Xapian::termcount get_wdf () const
 Return the wdf for the document at the current position. More...
 
virtual const std::string * get_sort_key () const
 
virtual const std::string * get_collapse_key () const
 If the collapse key is already known, return it. 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 Internalnext (double w_min)=0
 Advance the current position to the next document in the postlist. More...
 
virtual Internalskip_to (Xapian::docid did, double w_min)=0
 Skip forward to the specified docid. More...
 
virtual Internalcheck (Xapian::docid did, double w_min, bool &valid)
 Check if the specified docid occurs in this postlist. More...
 
Internalnext ()
 Advance the current position to the next document in the postlist. More...
 
Internalskip_to (Xapian::docid did)
 Skip forward to the specified docid. More...
 
virtual std::string get_description () const =0
 Return a string description of this object. More...
 
- Public Member Functions inherited from Xapian::Internal::intrusive_base
 intrusive_base ()
 Construct with no references. More...
 

Protected Member Functions

 LeafPostList (const std::string &term_)
 Only constructable as a base class for derived classes. More...
 
- Protected Member Functions inherited from Xapian::PostingIterator::Internal
 Internal ()
 Only constructable as a base class for derived classes. More...
 

Protected Attributes

const Xapian::Weightweight
 
bool need_doclength
 
bool need_unique_terms
 
std::string term
 The term name for this postlist (empty for an alldocs postlist). More...
 

Private Member Functions

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

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::intrusive_base
unsigned _refs
 Reference count. More...
 

Detailed Description

Abstract base class for leaf postlists.

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

Definition at line 39 of file leafpostlist.h.

Constructor & Destructor Documentation

◆ LeafPostList() [1/2]

LeafPostList::LeafPostList ( const LeafPostList )
private

Don't allow copying.

◆ LeafPostList() [2/2]

LeafPostList::LeafPostList ( const std::string &  term_)
inlineexplicitprotected

Only constructable as a base class for derived classes.

Definition at line 55 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::PostingIterator::Internal.

Definition at line 110 of file leafpostlist.cc.

◆ gather_position_lists()

void LeafPostList::gather_position_lists ( OrPositionList orposlist)
virtual

Gather PositionList* objects for a subtree.

Reimplemented from Xapian::PostingIterator::Internal.

Definition at line 116 of file leafpostlist.cc.

References OrPositionList::add_poslist().

◆ get_maxweight()

double LeafPostList::get_maxweight ( ) const
virtual

Return an upper bound on what get_weight() can return.

Implements Xapian::PostingIterator::Internal.

Definition at line 67 of file leafpostlist.cc.

Referenced by recalc_maxweight().

◆ get_termfreq()

virtual Xapian::doccount LeafPostList::get_termfreq ( ) const
pure virtual

◆ get_termfreq_est()

Xapian::doccount LeafPostList::get_termfreq_est ( ) const
virtual

Get an estimate of the number of documents indexed by this term.

It should always be true that: get_termfreq_min() <= get_termfreq_est() <= get_termfreq_max()

Implements Xapian::PostingIterator::Internal.

Definition at line 51 of file leafpostlist.cc.

◆ get_termfreq_est_using_stats()

TermFreqs LeafPostList::get_termfreq_est_using_stats ( const Xapian::Weight::Internal stats) const
virtual

Get an estimate for the termfreq and reltermfreq, given the stats.

The frequencies may be for a combination of databases, or for just the relevant documents, so the results need not lie in the bounds given by get_termfreq_min() and get_termfreq_max().

Reimplemented from Xapian::PostingIterator::Internal.

Definition at line 95 of file leafpostlist.cc.

References Assert, Xapian::Weight::Internal::collection_size, LOGCALL, RETURN, Xapian::Weight::Internal::rset_size, Xapian::Weight::Internal::termfreqs, and Xapian::Weight::Internal::total_length.

◆ get_termfreq_max()

Xapian::doccount LeafPostList::get_termfreq_max ( ) const
virtual

Get an upper bound on the number of documents indexed by this term.

Implements Xapian::PostingIterator::Internal.

Definition at line 45 of file leafpostlist.cc.

◆ get_termfreq_min()

Xapian::doccount LeafPostList::get_termfreq_min ( ) const
virtual

Get a lower bound on the number of documents indexed by this term.

Implements Xapian::PostingIterator::Internal.

Definition at line 39 of file leafpostlist.cc.

◆ get_wdf_upper_bound()

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

◆ get_weight()

double LeafPostList::get_weight ( ) const
virtual

Return the weight contribution for the current position.

Implements Xapian::PostingIterator::Internal.

Definition at line 73 of file leafpostlist.cc.

References AssertRel.

◆ open_nearby_postlist()

LeafPostList * LeafPostList::open_nearby_postlist ( const std::string &  term_) const
virtual

Open another postlist from the same database.

Parameters
term_The term to open a postlist for. 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.
Returns
The new postlist object, or NULL if not supported (in which case the caller should probably open the postlist via the database instead).

Reimplemented in GlassPostList.

Definition at line 122 of file leafpostlist.cc.

Referenced by LocalSubMatch::open_post_list().

◆ operator=()

void LeafPostList::operator= ( const LeafPostList )
private

Don't allow assignment.

◆ recalc_maxweight()

double LeafPostList::recalc_maxweight ( )
virtual

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

If the tree has pruned, get_maxweight() may use cached values. Calling this method instead forces a full recalculation.

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

Implements Xapian::PostingIterator::Internal.

Definition at line 89 of file leafpostlist.cc.

References get_maxweight().

◆ resolve_lazy_termweight()

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

◆ set_term()

void LeafPostList::set_term ( const std::string &  term_)
inline

Set the term name.

This is useful when we optimise a term matching all documents to an all documents postlist under OP_SYNONYM, as the term name is used by LeafPostList::get_termfreq_est_using_stats() to locate the appropriate TermFreqs object.

Definition at line 139 of file leafpostlist.h.

Referenced by LocalSubMatch::open_post_list().

◆ set_termweight()

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

Set the weighting scheme to use during matching.

If this isn't called, get_weight() and get_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 57 of file leafpostlist.cc.

References Assert.

Referenced by LocalSubMatch::open_post_list().

Member Data Documentation

◆ need_doclength

bool LeafPostList::need_doclength
protected

Definition at line 49 of file leafpostlist.h.

◆ need_unique_terms

bool LeafPostList::need_unique_terms
protected

Definition at line 49 of file leafpostlist.h.

◆ term

std::string LeafPostList::term
protected

◆ weight

const Xapian::Weight* LeafPostList::weight
protected

Definition at line 47 of file leafpostlist.h.


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