xapian-core
1.4.27
|
Abstract base class for postlists. More...
#include <postlist.h>
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 PositionList * | read_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 PositionList * | open_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 Internal * | next (double w_min)=0 |
Advance the current position to the next document in the postlist. More... | |
virtual Internal * | skip_to (Xapian::docid did, double w_min)=0 |
Skip forward to the specified docid. More... | |
virtual Internal * | check (Xapian::docid did, double w_min, bool &valid) |
Check if the specified docid occurs in this postlist. More... | |
Internal * | next () |
Advance the current position to the next document in the postlist. More... | |
Internal * | skip_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... | |
Abstract base class for postlists.
Definition at line 37 of file postlist.h.
|
private |
Don't allow copying.
|
inlineprotected |
Only constructable as a base class for derived classes.
Definition at line 46 of file postlist.h.
References at_end(), check(), get_collapse_key(), get_docid(), get_doclength(), get_maxweight(), get_sort_key(), get_termfreq_est(), get_termfreq_est_using_stats(), get_termfreq_max(), get_termfreq_min(), get_unique_terms(), get_wdf(), get_weight(), next(), open_position_list(), read_position_list(), recalc_maxweight(), skip_to(), and ~Internal().
Referenced by OrPosPostList::OrPosPostList().
|
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().
|
pure virtual |
Return true if the current position is past the last entry in this list.
Implemented in ChertPostList, GlassPostList, InMemoryAllDocsPostList, MultiAndPostList, InMemoryPostList, SynonymPostList, MultiXorPostList, MaxPostList, NetworkPostList, ExtraWeightPostList, MSetPostList, ContiguousAllDocsPostList, ValueRangePostList, ExternalPostList, MergePostList, ChertModifiedPostList, AndMaybePostList, SelectPostList, OrPosPostList, MultiPostList, ChertAllDocsModifiedPostList, OrPostList, AndNotPostList, and EmptyPostList.
Referenced by AndNotPostList::advance_to_next_match(), OrPostList::at_end(), OrPosPostList::at_end(), SelectPostList::at_end(), ExtraWeightPostList::at_end(), SynonymPostList::at_end(), SelectPostList::check(), OrPostList::check(), Xapian::Database::compact_(), Xapian::Database::Internal::delete_document(), Internal(), SelectPostList::next(), OrPostList::next(), AndMaybePostList::process_next_or_skip_to(), Xapian::Database::Internal::replace_document(), SelectPostList::skip_to(), OrPostList::skip_to(), and AndMaybePostList::sync_rhs().
|
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().
|
virtual |
Count the number of leaf subqueries which match at the current position.
Reimplemented in MultiAndPostList, AndMaybePostList, MaxPostList, MultiXorPostList, ExtraWeightPostList, LeafPostList, SynonymPostList, MergePostList, ValueRangePostList, ExternalPostList, OrPostList, AndNotPostList, OrPosPostList, and SelectPostList.
Referenced by SelectPostList::count_matching_subqs(), OrPosPostList::count_matching_subqs(), AndNotPostList::count_matching_subqs(), OrPostList::count_matching_subqs(), ExtraWeightPostList::count_matching_subqs(), AndMaybePostList::count_matching_subqs(), get_collapse_key(), and skip_to().
|
virtual |
Gather PositionList* objects for a subtree.
Reimplemented in MultiAndPostList, AndMaybePostList, LeafPostList, and OrPostList.
Referenced by OrPositionList::gather(), OrPostList::gather_position_lists(), AndMaybePostList::gather_position_lists(), get_collapse_key(), and skip_to().
|
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().
|
pure virtual |
Return a string description of this object.
Implemented in ChertPostList, GlassPostList, InMemoryAllDocsPostList, MultiAndPostList, InMemoryPostList, MultiXorPostList, SynonymPostList, MaxPostList, NetworkPostList, ExtraWeightPostList, ContiguousAllDocsPostList, ValueRangePostList, ExternalPostList, MSetPostList, MergePostList, ChertModifiedPostList, AndMaybePostList, SelectPostList, OrPosPostList, PhrasePostList, ExactPhrasePostList, MultiPostList, NearPostList, ChertAllDocsModifiedPostList, OrPostList, AndNotPostList, EmptyPostList, ChertAllDocsPostList, GlassAllDocsPostList, and ValueGePostList.
Referenced by AndNotPostList::get_description(), OrPostList::get_description(), NearPostList::get_description(), ExactPhrasePostList::get_description(), PhrasePostList::get_description(), OrPosPostList::get_description(), SelectPostList::get_description(), AndMaybePostList::get_description(), ExtraWeightPostList::get_description(), SynonymPostList::get_description(), MultiMatch::getorrecalc_maxweight(), and skip_to().
|
pure virtual |
Return the current docid.
Implemented in ChertPostList, InMemoryAllDocsPostList, GlassPostList, MultiAndPostList, InMemoryPostList, SynonymPostList, MultiXorPostList, MaxPostList, NetworkPostList, AndMaybePostList, MergePostList, ValueRangePostList, ExternalPostList, MSetPostList, ContiguousAllDocsPostList, ChertModifiedPostList, SelectPostList, OrPosPostList, MultiPostList, ExtraWeightPostList, OrPostList, ChertAllDocsModifiedPostList, AndNotPostList, and EmptyPostList.
Referenced by AndNotPostList::advance_to_next_match(), OrPostList::check(), Xapian::Database::compact_(), Xapian::Database::Internal::delete_document(), MultiAndPostList::find_next_match(), ExtraWeightPostList::get_docid(), OrPosPostList::get_docid(), SelectPostList::get_docid(), SynonymPostList::get_docid(), Internal(), OrPostList::next(), MaxPostList::next(), Xapian::PostingIterator::operator*(), AndMaybePostList::process_next_or_skip_to(), Xapian::Database::Internal::replace_document(), OrPostList::skip_to(), MaxPostList::skip_to(), and AndMaybePostList::sync_rhs().
|
pure virtual |
Return the length of current document.
Implemented in ChertPostList, InMemoryAllDocsPostList, GlassPostList, MultiAndPostList, InMemoryPostList, SynonymPostList, ExtraWeightPostList, MultiXorPostList, MaxPostList, MergePostList, AndMaybePostList, NetworkPostList, MSetPostList, ValueRangePostList, ExternalPostList, OrPostList, ContiguousAllDocsPostList, AndNotPostList, SelectPostList, ChertModifiedPostList, OrPosPostList, MultiPostList, ChertAllDocsModifiedPostList, EmptyPostList, ChertAllDocsPostList, and GlassAllDocsPostList.
Referenced by OrPosPostList::get_doclength(), SelectPostList::get_doclength(), AndNotPostList::get_doclength(), OrPostList::get_doclength(), AndMaybePostList::get_doclength(), Xapian::PostingIterator::get_doclength(), ExtraWeightPostList::get_doclength(), SynonymPostList::get_doclength(), ExtraWeightPostList::get_weight(), and Internal().
|
pure virtual |
Return an upper bound on what get_weight() can return.
Implemented in MultiAndPostList, LeafPostList, SynonymPostList, MultiXorPostList, MaxPostList, MergePostList, AndMaybePostList, ValueRangePostList, ExternalPostList, ExtraWeightPostList, MSetPostList, SelectPostList, OrPosPostList, OrPostList, AndNotPostList, MultiPostList, and EmptyPostList.
Referenced by AndMaybePostList::AndMaybePostList(), AndNotPostList::get_maxweight(), OrPosPostList::get_maxweight(), SelectPostList::get_maxweight(), ExtraWeightPostList::get_maxweight(), MultiMatch::getorrecalc_maxweight(), Internal(), and Xapian::Internal::CmpMaxOrTerms::operator()().
|
virtual |
Reimplemented in MSetPostList, and MergePostList.
Definition at line 50 of file postlist.cc.
Referenced by Internal().
|
pure 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()
Implemented in MultiAndPostList, LeafPostList, SynonymPostList, MaxPostList, MultiXorPostList, MergePostList, AndMaybePostList, ExternalPostList, MSetPostList, PhrasePostList, ExactPhrasePostList, ValueRangePostList, NearPostList, ExtraWeightPostList, OrPosPostList, MultiPostList, OrPostList, AndNotPostList, and EmptyPostList.
Referenced by AndNotPostList::get_termfreq_est(), OrPostList::get_termfreq_est(), OrPosPostList::get_termfreq_est(), ExtraWeightPostList::get_termfreq_est(), NearPostList::get_termfreq_est(), ExactPhrasePostList::get_termfreq_est(), PhrasePostList::get_termfreq_est(), AndMaybePostList::get_termfreq_est(), SynonymPostList::get_termfreq_est(), Internal(), LocalSubMatch::make_synonym_postlist(), MultiAndPostList::MultiAndPostList(), MultiAndPostList::ComparePostListTermFreqAscending::operator()(), Xapian::Internal::ComparePostListTermFreqAscending::operator()(), and OrPostList::OrPostList().
|
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 in MultiAndPostList, LeafPostList, MultiXorPostList, AndMaybePostList, PhrasePostList, ValueRangePostList, ExactPhrasePostList, NearPostList, OrPosPostList, OrPostList, AndNotPostList, and EmptyPostList.
Definition at line 36 of file postlist.cc.
Referenced by AndNotPostList::get_termfreq_est_using_stats(), OrPostList::get_termfreq_est_using_stats(), OrPosPostList::get_termfreq_est_using_stats(), NearPostList::get_termfreq_est_using_stats(), ExactPhrasePostList::get_termfreq_est_using_stats(), PhrasePostList::get_termfreq_est_using_stats(), AndMaybePostList::get_termfreq_est_using_stats(), Internal(), and LocalSubMatch::make_synonym_postlist().
|
pure virtual |
Get an upper bound on the number of documents indexed by this term.
Implemented in MultiAndPostList, LeafPostList, SynonymPostList, MaxPostList, MultiXorPostList, MergePostList, ExternalPostList, MSetPostList, AndMaybePostList, ValueRangePostList, SelectPostList, MultiPostList, OrPosPostList, OrPostList, AndNotPostList, ExtraWeightPostList, and EmptyPostList.
Referenced by ExtraWeightPostList::get_termfreq_max(), AndNotPostList::get_termfreq_max(), OrPostList::get_termfreq_max(), OrPosPostList::get_termfreq_max(), SelectPostList::get_termfreq_max(), AndMaybePostList::get_termfreq_max(), SynonymPostList::get_termfreq_max(), AndNotPostList::get_termfreq_min(), Internal(), and LocalSubMatch::make_synonym_postlist().
|
pure virtual |
Get a lower bound on the number of documents indexed by this term.
Implemented in MultiAndPostList, LeafPostList, SynonymPostList, MaxPostList, MultiXorPostList, MergePostList, AndMaybePostList, ExternalPostList, MSetPostList, ValueRangePostList, SelectPostList, MultiPostList, ExtraWeightPostList, OrPostList, AndNotPostList, OrPosPostList, and EmptyPostList.
Referenced by MultiMatch::get_mset(), AndNotPostList::get_termfreq_min(), OrPosPostList::get_termfreq_min(), ExtraWeightPostList::get_termfreq_min(), OrPostList::get_termfreq_min(), AndMaybePostList::get_termfreq_min(), SynonymPostList::get_termfreq_min(), and Internal().
|
pure virtual |
Return the number of unique terms in the current document.
Implemented in ChertPostList, InMemoryAllDocsPostList, GlassPostList, MultiAndPostList, InMemoryPostList, SynonymPostList, ExtraWeightPostList, MultiXorPostList, MaxPostList, MergePostList, AndMaybePostList, NetworkPostList, MSetPostList, OrPostList, ValueRangePostList, ExternalPostList, ContiguousAllDocsPostList, AndNotPostList, ChertModifiedPostList, SelectPostList, OrPosPostList, MultiPostList, ChertAllDocsModifiedPostList, and EmptyPostList.
Referenced by OrPosPostList::get_unique_terms(), SelectPostList::get_unique_terms(), AndNotPostList::get_unique_terms(), OrPostList::get_unique_terms(), AndMaybePostList::get_unique_terms(), Xapian::PostingIterator::get_unique_terms(), ExtraWeightPostList::get_unique_terms(), SynonymPostList::get_unique_terms(), and Internal().
|
virtual |
Return the wdf for the document at the current position.
The default implementation throws Xapian::UnimplementedError.
Reimplemented in ChertPostList, InMemoryAllDocsPostList, MultiAndPostList, GlassPostList, InMemoryPostList, AndMaybePostList, MultiXorPostList, MaxPostList, SynonymPostList, OrPostList, NetworkPostList, AndNotPostList, OrPosPostList, ContiguousAllDocsPostList, ChertModifiedPostList, MergePostList, PhrasePostList, ExactPhrasePostList, MultiPostList, NearPostList, ChertAllDocsPostList, and GlassAllDocsPostList.
Definition at line 44 of file postlist.cc.
Referenced by OrPosPostList::get_wdf(), AndNotPostList::get_wdf(), OrPostList::get_wdf(), Xapian::PostingIterator::get_wdf(), SynonymPostList::get_wdf(), AndMaybePostList::get_wdf(), Internal(), and TermCmp::operator()().
|
pure virtual |
Return the weight contribution for the current position.
Implemented in MultiAndPostList, LeafPostList, MultiXorPostList, MaxPostList, SynonymPostList, AndMaybePostList, ValueRangePostList, ExternalPostList, MergePostList, MSetPostList, OrPosPostList, SelectPostList, ExtraWeightPostList, OrPostList, MultiPostList, AndNotPostList, and EmptyPostList.
Referenced by AndNotPostList::get_weight(), OrPostList::get_weight(), ExtraWeightPostList::get_weight(), SelectPostList::get_weight(), OrPosPostList::get_weight(), AndMaybePostList::get_weight(), and Internal().
|
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.
w_min | The minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore). |
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().
|
inline |
Advance the current position to the next document in the postlist.
Any weight contribution is acceptable.
Definition at line 194 of file postlist.h.
References next().
Referenced by ContiguousAllDocsPostList::ContiguousAllDocsPostList(), EmptyPostList::EmptyPostList(), Internal(), MSetPostList::MSetPostList(), MultiAndPostList::MultiAndPostList(), ChertAllDocsModifiedPostList::next(), ChertModifiedPostList::next(), next(), OrPosPostList::OrPosPostList(), MaxPostList::read_position_list(), MultiXorPostList::read_position_list(), ChertAllDocsModifiedPostList::skip_deletes(), ChertModifiedPostList::skip_deletes(), SelectPostList::skip_to(), InMemoryPostList::skip_to(), SynonymPostList::SynonymPostList(), NearPostList::test_doc(), PhrasePostList::test_doc(), ValueGePostList::ValueGePostList(), and ValueRangePostList::ValueRangePostList().
|
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().
|
private |
Don't allow assignment.
|
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().
|
pure 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.
Implemented in MultiAndPostList, LeafPostList, MultiXorPostList, MaxPostList, SynonymPostList, MSetPostList, ValueRangePostList, ExternalPostList, MergePostList, AndMaybePostList, ExtraWeightPostList, OrPosPostList, SelectPostList, OrPostList, AndNotPostList, MultiPostList, and EmptyPostList.
Referenced by MultiMatch::getorrecalc_maxweight(), Internal(), MultiXorPostList::next(), AndNotPostList::recalc_maxweight(), OrPostList::recalc_maxweight(), OrPosPostList::recalc_maxweight(), SelectPostList::recalc_maxweight(), ExtraWeightPostList::recalc_maxweight(), AndMaybePostList::recalc_maxweight(), and MultiXorPostList::skip_to().
|
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).
w_min | The minimum weight contribution that is needed (this is just a hint which PostList subclasses may ignore). |
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().
|
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().