xapian-core  1.4.27
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Xapian::PostingIterator::Internal Class Referenceabstract

Abstract base class for postlists. More...

#include <postlist.h>

+ Inheritance diagram for Xapian::PostingIterator::Internal:
+ Collaboration diagram for Xapian::PostingIterator::Internal:

Public Member Functions

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::doccount get_termfreq_min () const =0
 Get a lower bound on the number of documents indexed by this term. More...
 
virtual Xapian::doccount get_termfreq_max () const =0
 Get an upper bound on the number of documents indexed by this term. More...
 
virtual Xapian::doccount get_termfreq_est () const =0
 Get an estimate of the number of documents indexed by this term. More...
 
virtual TermFreqs get_termfreq_est_using_stats (const Xapian::Weight::Internal &stats) const
 Get an estimate for the termfreq and reltermfreq, given the stats. More...
 
virtual double get_maxweight () const =0
 Return an upper bound on what get_weight() can return. 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 double get_weight () const =0
 Return the weight contribution for 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 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 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 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 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

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

Private Member Functions

void operator= (const Internal &)
 Don't allow assignment. More...
 
 Internal (const Internal &)
 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 postlists.

Definition at line 37 of file postlist.h.

Constructor & Destructor Documentation

◆ Internal() [1/2]

Xapian::PostingIterator::Internal::Internal ( const Internal )
private

Don't allow copying.

◆ Internal() [2/2]

Xapian::PostingIterator::Internal::Internal ( )
inlineprotected

◆ ~Internal()

Xapian::PostingIterator::Internal::~Internal ( )
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 33 of file postlist.cc.

Referenced by Internal().

Member Function Documentation

◆ at_end()

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

◆ check()

virtual Internal* Xapian::PostingIterator::Internal::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, ExternalPostList, OrPostList, SelectPostList, and ValueGePostList.

Referenced by SelectPostList::check(), check_handling_prune(), MultiAndPostList::check_helper(), get_collapse_key(), and Internal().

◆ count_matching_subqs()

virtual Xapian::termcount Xapian::PostingIterator::Internal::count_matching_subqs ( ) const
virtual

◆ gather_position_lists()

virtual void Xapian::PostingIterator::Internal::gather_position_lists ( OrPositionList orposlist)
virtual

◆ get_collapse_key()

const string * Xapian::PostingIterator::Internal::get_collapse_key ( ) const
virtual

If the collapse key is already known, return it.

This is implemented by MSetPostList (and MergePostList). Other subclasses rely on the default implementation which just returns NULL.

Reimplemented in MSetPostList, and MergePostList.

Definition at line 56 of file postlist.cc.

References Assert, check(), count_matching_subqs(), gather_position_lists(), open_position_list(), and read_position_list().

Referenced by Internal(), and Collapser::process().

◆ get_description()

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

◆ get_docid()

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

◆ get_doclength()

virtual Xapian::termcount Xapian::PostingIterator::Internal::get_doclength ( ) const
pure virtual

◆ get_maxweight()

virtual double Xapian::PostingIterator::Internal::get_maxweight ( ) const
pure virtual

◆ get_sort_key()

const string * Xapian::PostingIterator::Internal::get_sort_key ( ) const
virtual

Reimplemented in MSetPostList, and MergePostList.

Definition at line 50 of file postlist.cc.

Referenced by Internal().

◆ get_termfreq_est()

virtual Xapian::doccount Xapian::PostingIterator::Internal::get_termfreq_est ( ) const
pure virtual

◆ get_termfreq_est_using_stats()

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

◆ get_termfreq_max()

virtual Xapian::doccount Xapian::PostingIterator::Internal::get_termfreq_max ( ) const
pure virtual

◆ get_termfreq_min()

virtual Xapian::doccount Xapian::PostingIterator::Internal::get_termfreq_min ( ) const
pure virtual

◆ get_unique_terms()

virtual Xapian::termcount Xapian::PostingIterator::Internal::get_unique_terms ( ) const
pure virtual

◆ get_wdf()

Xapian::termcount Xapian::PostingIterator::Internal::get_wdf ( ) const
virtual

◆ get_weight()

virtual double Xapian::PostingIterator::Internal::get_weight ( ) const
pure virtual

◆ next() [1/2]

virtual Internal* Xapian::PostingIterator::Internal::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 ChertPostList, GlassPostList, InMemoryAllDocsPostList, MultiAndPostList, InMemoryPostList, MultiXorPostList, MaxPostList, SynonymPostList, NetworkPostList, MSetPostList, ContiguousAllDocsPostList, ValueRangePostList, ExternalPostList, MergePostList, AndMaybePostList, ChertModifiedPostList, ExtraWeightPostList, OrPosPostList, MultiPostList, OrPostList, ChertAllDocsModifiedPostList, AndNotPostList, EmptyPostList, SelectPostList, and ValueGePostList.

Referenced by Xapian::Database::compact_(), Xapian::Database::Internal::delete_document(), SelectPostList::next(), AndNotPostList::next(), OrPosPostList::next(), ExtraWeightPostList::next(), AndMaybePostList::next(), MaxPostList::next(), MultiXorPostList::next(), next_handling_prune(), MultiAndPostList::next_helper(), Xapian::PostingIterator::operator++(), Xapian::PostingIterator::PostingIterator(), and Xapian::Database::Internal::replace_document().

◆ next() [2/2]

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

◆ open_position_list()

virtual PositionList* Xapian::PostingIterator::Internal::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 ChertPostList, GlassPostList, InMemoryAllDocsPostList, InMemoryPostList, NetworkPostList, ContiguousAllDocsPostList, ChertModifiedPostList, SelectPostList, MultiPostList, ChertAllDocsPostList, and GlassAllDocsPostList.

Referenced by get_collapse_key(), Internal(), SelectPostList::open_position_list(), and Xapian::PostingIterator::positionlist_begin().

◆ operator=()

void Xapian::PostingIterator::Internal::operator= ( const Internal )
private

Don't allow assignment.

◆ read_position_list()

virtual PositionList* Xapian::PostingIterator::Internal::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 ChertPostList, InMemoryAllDocsPostList, GlassPostList, InMemoryPostList, MultiXorPostList, MaxPostList, ValueRangePostList, ExternalPostList, ContiguousAllDocsPostList, ChertModifiedPostList, OrPosPostList, SelectPostList, ChertAllDocsPostList, and GlassAllDocsPostList.

Referenced by get_collapse_key(), Internal(), and SelectPostList::read_position_list().

◆ recalc_maxweight()

virtual double Xapian::PostingIterator::Internal::recalc_maxweight ( )
pure virtual

◆ skip_to() [1/2]

virtual Internal* Xapian::PostingIterator::Internal::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 ChertPostList, GlassPostList, InMemoryAllDocsPostList, MultiAndPostList, InMemoryPostList, MultiXorPostList, MaxPostList, NetworkPostList, SynonymPostList, MSetPostList, ContiguousAllDocsPostList, ExtraWeightPostList, ValueRangePostList, ExternalPostList, MergePostList, AndMaybePostList, ChertModifiedPostList, OrPosPostList, MultiPostList, ChertAllDocsModifiedPostList, OrPostList, AndNotPostList, EmptyPostList, SelectPostList, and ValueGePostList.

Referenced by Xapian::Database::compact_(), Internal(), MaxPostList::next(), SelectPostList::skip_to(), AndNotPostList::skip_to(), OrPosPostList::skip_to(), AndMaybePostList::skip_to(), ExtraWeightPostList::skip_to(), MaxPostList::skip_to(), MultiXorPostList::skip_to(), Xapian::PostingIterator::skip_to(), skip_to_handling_prune(), and MultiAndPostList::skip_to_helper().

◆ skip_to() [2/2]

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

Skip forward to the specified docid.

Any weight contribution is acceptable.

Definition at line 200 of file postlist.h.

References count_matching_subqs(), gather_position_lists(), get_description(), and skip_to().

Referenced by skip_to().


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