|
xapian-core
2.0.0
|
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 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 PostList * | next (double w_min)=0 |
| Advance the current position to the next document in the postlist. More... | |
| virtual PostList * | skip_to (Xapian::docid did, double w_min)=0 |
| Skip forward to the specified docid. More... | |
| virtual PostList * | check (Xapian::docid did, double w_min, bool &valid) |
| Check if the specified docid occurs in this postlist. More... | |
| PostList * | next () |
| Advance the current position to the next document in the postlist. More... | |
| PostList * | 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 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... | |
Abstract base class for postlists.
Definition at line 40 of file postlist.h.
|
privatedelete |
Don't allow copying.
|
inlineprotected |
Only constructable as a base class for derived classes.
Definition at line 55 of file postlist.h.
|
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.
|
pure virtual |
Return true if the current position is past the last entry in this list.
Implemented in XorPostList, WrapperPostList, ValueRangePostList, SelectPostList, OrPostList, MaxPostList, ExternalPostList, BoolOrPostList, AndPostList, NetworkPostList, MultiPostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPostList, HoneyAllDocsPostList, GlassPostList, and ContiguousAllDocsPostList.
Referenced by WrapperPostList::at_end(), OrPostList::check(), Xapian::Database::compact_(), Xapian::PostingIterator::Internal::next(), MultiPostList::next(), OrPostList::next(), PostListTree::next(), Xapian::PostingIterator::Internal::skip_to(), OrPostList::skip_to(), MultiPostList::skip_to(), and SelectPostList::vet().
|
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().
|
virtual |
Count the number of leaf subqueries which match at the current position.
Reimplemented in XorPostList, WrapperPostList, ValueRangePostList, SynonymPostList, OrPostList, MaxPostList, ExternalPostList, BoolOrPostList, AndPostList, AndMaybePostList, and LeafPostList.
Definition at line 59 of file postlist.cc.
References Assert.
Referenced by BoolOrPostList::count_matching_subqs(), OrPostList::count_matching_subqs(), PostListTree::count_matching_subqs(), and WrapperPostList::count_matching_subqs().
|
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().
|
pure virtual |
Return a string description of this object.
Implemented in XorPostList, WrapperPostList, ValueRangePostList, ValueGePostList, SynonymPostList, PhrasePostList, OrPostList, OrPosPostList, NearPostList, MaxPostList, ExtraWeightPostList, ExternalPostList, ExactPhrasePostList, DeciderPostList, BoolOrPostList, AndPostList, AndNotPostList, AndMaybePostList, NetworkPostList, MultiPostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPosPostList, HoneyPostList, HoneyAllDocsPostList, GlassPostList, GlassAllDocsPostList, and ContiguousAllDocsPostList.
Referenced by Xapian::PostingIterator::Internal::get_description(), ExactPhrasePostList::get_description(), NearPostList::get_description(), OrPostList::get_description(), PhrasePostList::get_description(), PostListTree::get_description(), and WrapperPostList::get_description().
|
pure virtual |
Return the current docid.
Implemented in XorPostList, WrapperPostList, ValueRangePostList, OrPostList, MaxPostList, ExternalPostList, BoolOrPostList, AndPostList, AndMaybePostList, NetworkPostList, MultiPostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPostList, HoneyAllDocsPostList, GlassPostList, and ContiguousAllDocsPostList.
Referenced by AndMaybePostList::check(), AndNotPostList::check(), OrPostList::check(), Xapian::Database::compact_(), AndPostList::find_next_match(), Xapian::PostingIterator::Internal::get_docid(), PostListTree::get_docid(), WrapperPostList::get_docid(), Xapian::PostingIterator::Internal::get_doclength(), Xapian::PostingIterator::Internal::get_unique_terms(), Xapian::PostingIterator::Internal::get_wdfdocmax(), PostListTree::get_weight(), MultiPostList::next(), AndMaybePostList::next(), AndNotPostList::next(), MaxPostList::next(), OrPostList::next(), AndMaybePostList::skip_to(), AndNotPostList::skip_to(), BoolOrPostList::skip_to(), OrPostList::skip_to(), SelectPostList::skip_to(), MultiPostList::skip_to(), MaxPostList::skip_to(), and SelectPostList::vet().
|
virtual |
Get the bounds on the range of docids this PostList can return.
| [out] | first | Set 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] | last | Set 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().
|
inline |
Get an estimate of the number of documents this PostList will return.
This should be exact for terms.
Definition at line 67 of file postlist.h.
References termfreq.
Referenced by AndNotPostList::AndNotPostList(), AndPostList::AndPostList(), BoolOrPostList::BoolOrPostList(), ExactPhrasePostList::ExactPhrasePostList(), MaxPostList::MaxPostList(), MultiPostList::MultiPostList(), NearPostList::NearPostList(), GlassPostList::open_nearby_postlist(), LocalSubMatch::open_post_list(), Xapian::Internal::ComparePostListTermFreqAscending::operator()(), AndPostList::ComparePostListTermFreqAscending::operator()(), OrPostList::OrPostList(), PhrasePostList::PhrasePostList(), LocalSubMatch::register_lazy_postlist_for_stats(), LeafPostList::resolve_lazy_termweight(), WrapperPostList::WrapperPostList(), and XorPostList::XorPostList().
|
virtual |
Return the wdf for the document at the current position.
The default implementation throws Xapian::UnimplementedError.
Reimplemented in XorPostList, WrapperPostList, PhrasePostList, OrPostList, NearPostList, MaxPostList, ExactPhrasePostList, BoolOrPostList, AndPostList, AndMaybePostList, NetworkPostList, MultiPostList, InMemoryAllDocsPostList, InMemoryPostList, HoneyPostList, HoneyAllDocsPostList, GlassPostList, GlassAllDocsPostList, and ContiguousAllDocsPostList.
Definition at line 34 of file postlist.cc.
Referenced by Xapian::PostingIterator::Internal::get_wdf(), BoolOrPostList::get_wdf(), OrPostList::get_wdf(), WrapperPostList::get_wdf(), and TermCmp::operator()().
|
pure virtual |
Return the weight contribution for the current position.
Implemented in XorPostList, WrapperPostList, ValueRangePostList, SynonymPostList, SelectPostList, OrPostList, MaxPostList, ExtraWeightPostList, ExternalPostList, BoolOrPostList, AndPostList, AndMaybePostList, MultiPostList, and LeafPostList.
Referenced by PostListTree::get_weight(), OrPostList::get_weight(), SelectPostList::get_weight(), WrapperPostList::get_weight(), and SelectPostList::vet().
|
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().
|
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 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().
|
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().
|
privatedelete |
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 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().
|
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().
|
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().
|
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 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().
|
protected |
Estimate of the number of documents this PostList will return.
This should be exact for terms.
Definition at line 52 of file postlist.h.
Referenced by AndNotPostList::AndNotPostList(), AndPostList::AndPostList(), BoolOrPostList::BoolOrPostList(), OrPostList::decay_to_and(), ExactPhrasePostList::ExactPhrasePostList(), ExternalPostList::ExternalPostList(), GlassAllDocsPostList::get_description(), GlassPostList::get_description(), HoneyAllDocsPostList::get_description(), InMemoryPostList::get_description(), HoneyPostList::get_docid_range(), get_termfreq(), HoneyPostList::HoneyPostList(), GlassPostList::init(), InMemoryPostList::InMemoryPostList(), MaxPostList::MaxPostList(), GlassPostList::move_to_chunk_containing(), MultiPostList::MultiPostList(), NearPostList::NearPostList(), NetworkPostList::NetworkPostList(), OrPostList::OrPostList(), PhrasePostList::PhrasePostList(), ValueRangePostList::ValueRangePostList(), WrapperPostList::WrapperPostList(), and XorPostList::XorPostList().