xapian-core  2.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Xapian::Internal::PostList Class Referenceabstract

Abstract base class for postlists. More...

#include <postlist.h>

+ Inheritance diagram for Xapian::Internal::PostList:

Public Member Functions

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 double get_weight (Xapian::termcount doclen, Xapian::termcount unique_terms, Xapian::termcount wdfdocmax) const =0
 Return the weight contribution for 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 double recalc_maxweight ()=0
 Recalculate the upper bound on what get_weight() can 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 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 Xapian::termcount count_matching_subqs () const
 Count the number of leaf subqueries which match at the current position. More...
 
virtual void gather_position_lists (OrPositionList *orposlist)
 Gather PositionList* objects for a subtree. 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

 PostList ()
 Only constructable as a base class for derived classes. More...
 

Protected Attributes

Xapian::doccount termfreq
 Estimate of the number of documents this PostList will return. More...
 

Private Member Functions

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

Detailed Description

Abstract base class for postlists.

Definition at line 40 of file postlist.h.

Constructor & Destructor Documentation

◆ PostList() [1/2]

Xapian::Internal::PostList::PostList ( const PostList )
privatedelete

Don't allow copying.

◆ PostList() [2/2]

Xapian::Internal::PostList::PostList ( )
inlineprotected

Only constructable as a base class for derived classes.

Definition at line 55 of file postlist.h.

◆ ~PostList()

PostList::~PostList ( )
virtual

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.

Definition at line 31 of file postlist.cc.

Member Function Documentation

◆ at_end()

virtual bool Xapian::Internal::PostList::at_end ( ) const
pure virtual

◆ check()

PostList * PostList::check ( Xapian::docid  did,
double  w_min,
bool &  valid 
)
virtual

Check if the specified docid occurs in this postlist.

The caller is required to ensure that the specified docid actually exists in the database.

This method acts like skip_to() if that can be done at little extra cost, in which case it then sets valid to true.

Otherwise it simply checks if a particular docid is present. If it is, valid is set to true. If it isn't, it sets valid to false, and leaves the position unspecified (and hence the result of calling methods which depend on the current position, such as get_docid() and at_end(), are also unspecified). In this state, next() will advance to the first matching position after docid, and skip_to() will act as it would if the position was the first matching position after docid. If valid is set to false, then NULL must be returned (pruning in this situation doesn't make sense).

The default implementation calls skip_to().

Reimplemented in ValueRangePostList, ValueGePostList, SelectPostList, OrPostList, ExternalPostList, AndNotPostList, AndMaybePostList, and HoneyAllDocsPostList.

Definition at line 52 of file postlist.cc.

Referenced by AndMaybePostList::check(), AndNotPostList::check(), OrPostList::check(), SelectPostList::check(), AndPostList::check_helper(), AndMaybePostList::decay_to_and(), OrPostList::decay_to_and(), OrPostList::decay_to_andmaybe(), AndMaybePostList::next(), AndNotPostList::next(), AndMaybePostList::skip_to(), and AndNotPostList::skip_to().

◆ count_matching_subqs()

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

◆ gather_position_lists()

void PostList::gather_position_lists ( OrPositionList orposlist)
virtual

Gather PositionList* objects for a subtree.

Reimplemented in OrPostList, BoolOrPostList, AndPostList, AndMaybePostList, and LeafPostList.

Definition at line 66 of file postlist.cc.

References Assert.

Referenced by OrPositionList::gather(), BoolOrPostList::gather_position_lists(), and OrPostList::gather_position_lists().

◆ get_description()

virtual std::string Xapian::Internal::PostList::get_description ( ) const
pure virtual

◆ get_docid()

virtual Xapian::docid Xapian::Internal::PostList::get_docid ( ) const
pure virtual

◆ get_docid_range()

void PostList::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 in XorPostList, OrPostList, MaxPostList, BoolOrPostList, AndPostList, InMemoryPostList, HoneyPostList, and GlassPostList.

Definition at line 72 of file postlist.cc.

Referenced by Xapian::Internal::Context::add_postlist(), Xapian::Internal::AndContext::add_postlist(), AndPostList::AndPostList(), OrPostList::get_docid_range(), LocalSubMatch::open_post_list(), and OrPostList::OrPostList().

◆ get_termfreq()

Xapian::doccount Xapian::Internal::PostList::get_termfreq ( ) const
inline

◆ get_wdf()

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

◆ get_weight()

virtual double Xapian::Internal::PostList::get_weight ( Xapian::termcount  doclen,
Xapian::termcount  unique_terms,
Xapian::termcount  wdfdocmax 
) const
pure virtual

◆ next() [1/2]

PostList* Xapian::Internal::PostList::next ( )
inline

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

Any weight contribution is acceptable.

Definition at line 168 of file postlist.h.

References next().

Referenced by next(), SynonymPostList::next(), InMemoryPostList::skip_to(), AndNotPostList::skip_to(), SelectPostList::skip_to(), MultiPostList::skip_to(), NearPostList::test_doc(), and PhrasePostList::test_doc().

◆ next() [2/2]

virtual PostList* Xapian::Internal::PostList::next ( double  w_min)
pure 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.

Implemented in NetworkPostList, XorPostList, WrapperPostList, ValueRangePostList, ValueGePostList, SynonymPostList, SelectPostList, OrPostList, MaxPostList, ExtraWeightPostList, ExternalPostList, BoolOrPostList, AndPostList, AndNotPostList, AndMaybePostList, MultiPostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPostList, HoneyAllDocsPostList, GlassPostList, and ContiguousAllDocsPostList.

Referenced by Xapian::Database::compact_(), Xapian::PostingIterator::Internal::next(), MultiPostList::next(), AndMaybePostList::next(), AndNotPostList::next(), BoolOrPostList::next(), ExtraWeightPostList::next(), MaxPostList::next(), OrPostList::next(), PostListTree::next(), SelectPostList::next(), WrapperPostList::next(), XorPostList::next(), and AndPostList::next_helper().

◆ open_position_list()

PositionList * PostList::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 in NetworkPostList, MultiPostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPostList, GlassPostList, GlassAllDocsPostList, and ContiguousAllDocsPostList.

Definition at line 46 of file postlist.cc.

Referenced by Xapian::PostingIterator::Internal::open_position_list().

◆ operator=()

void Xapian::Internal::PostList::operator= ( const PostList )
privatedelete

Don't allow assignment.

◆ read_position_list()

PositionList * PostList::read_position_list ( )
virtual

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

The default implementation throws Xapian::UnimplementedError.

Reimplemented in XorPostList, WrapperPostList, ValueRangePostList, OrPosPostList, MaxPostList, ExternalPostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPosPostList, GlassPostList, GlassAllDocsPostList, and ContiguousAllDocsPostList.

Definition at line 40 of file postlist.cc.

Referenced by WrapperPostList::read_position_list().

◆ recalc_maxweight()

virtual double Xapian::Internal::PostList::recalc_maxweight ( )
pure 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.

Implemented in XorPostList, WrapperPostList, ValueRangePostList, SynonymPostList, OrPostList, MaxPostList, ExtraWeightPostList, ExternalPostList, BoolOrPostList, AndPostList, AndMaybePostList, MultiPostList, and LeafPostList.

Referenced by Xapian::Internal::CmpMaxOrTerms::operator()(), OrPostList::recalc_maxweight(), and WrapperPostList::recalc_maxweight().

◆ skip_to() [1/2]

PostList* Xapian::Internal::PostList::skip_to ( Xapian::docid  did)
inline

Skip forward to the specified docid.

Any weight contribution is acceptable.

Definition at line 174 of file postlist.h.

References skip_to().

Referenced by skip_to().

◆ skip_to() [2/2]

virtual PostList* Xapian::Internal::PostList::skip_to ( Xapian::docid  did,
double  w_min 
)
pure 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.

Implemented in XorPostList, WrapperPostList, ValueRangePostList, ValueGePostList, MaxPostList, ExtraWeightPostList, ExternalPostList, AndPostList, MultiPostList, ContiguousAllDocsPostList, NetworkPostList, SynonymPostList, SelectPostList, OrPostList, BoolOrPostList, AndNotPostList, AndMaybePostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPostList, HoneyAllDocsPostList, and GlassPostList.

Referenced by Xapian::Database::compact_(), AndMaybePostList::decay_to_and(), OrPostList::decay_to_and(), OrPostList::decay_to_andmaybe(), MaxPostList::next(), Xapian::PostingIterator::Internal::skip_to(), AndMaybePostList::skip_to(), AndNotPostList::skip_to(), BoolOrPostList::skip_to(), OrPostList::skip_to(), SelectPostList::skip_to(), MultiPostList::skip_to(), MaxPostList::skip_to(), WrapperPostList::skip_to(), XorPostList::skip_to(), and AndPostList::skip_to_helper().

Member Data Documentation

◆ termfreq

Xapian::doccount Xapian::Internal::PostList::termfreq
protected

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