xapian-core
1.4.27
|
Abstract base class for leaf postlists. More...
#include <leafpostlist.h>
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 LeafPostList * | open_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 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 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::Weight * | weight |
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... | |
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.
|
private |
Don't allow copying.
|
inlineexplicitprotected |
Only constructable as a base class for derived classes.
Definition at line 55 of file leafpostlist.h.
LeafPostList::~LeafPostList | ( | ) |
Definition at line 33 of file leafpostlist.cc.
|
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.
|
virtual |
Gather PositionList* objects for a subtree.
Reimplemented from Xapian::PostingIterator::Internal.
Definition at line 116 of file leafpostlist.cc.
References OrPositionList::add_poslist().
|
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().
|
pure virtual |
Return the exact term frequency.
Leaf postlists have an exact termfreq, which get_termfreq_min(), get_termfreq_max(), and get_termfreq_est() all report.
Implemented in ChertPostList, InMemoryAllDocsPostList, GlassPostList, InMemoryPostList, NetworkPostList, ChertModifiedPostList, ContiguousAllDocsPostList, ChertAllDocsPostList, and GlassAllDocsPostList.
Referenced by LocalSubMatch::open_post_list().
|
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.
|
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.
|
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.
|
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.
|
pure virtual |
Implemented in ChertPostList, GlassPostList, InMemoryAllDocsPostList, InMemoryPostList, NetworkPostList, and ContiguousAllDocsPostList.
Referenced by Xapian::Weight::init_().
|
virtual |
Return the weight contribution for the current position.
Implements Xapian::PostingIterator::Internal.
Definition at line 73 of file leafpostlist.cc.
References AssertRel.
|
virtual |
Open another postlist from the same database.
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. |
Reimplemented in GlassPostList.
Definition at line 122 of file leafpostlist.cc.
Referenced by LocalSubMatch::open_post_list().
|
private |
Don't allow assignment.
|
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().
|
inline |
Definition at line 73 of file leafpostlist.h.
References Assert, Xapian::Weight::get_maxpart(), Xapian::Weight::get_sumpart_needs_doclength_(), Xapian::Weight::init_(), and Xapian::Weight::Internal::termfreqs.
|
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().
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.
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().
|
protected |
Definition at line 49 of file leafpostlist.h.
|
protected |
Definition at line 49 of file leafpostlist.h.
|
protected |
The term name for this postlist (empty for an alldocs postlist).
Definition at line 52 of file leafpostlist.h.
Referenced by ChertPostList::ChertPostList(), GlassPostList::get_description(), ChertPostList::get_description(), GlassDatabase::get_postlist_cursor(), ChertDatabase::get_postlist_cursor(), ChertModifiedPostList::get_termfreq(), GlassPostList::get_wdf_upper_bound(), GlassPostList::init(), GlassPostList::move_to_chunk_containing(), ChertPostList::move_to_chunk_containing(), GlassPostList::next_chunk(), ChertPostList::next_chunk(), ChertModifiedPostList::open_position_list(), GlassPostList::open_position_list(), ChertPostList::open_position_list(), ChertModifiedPostList::read_position_list(), GlassPostList::read_position_list(), and ChertPostList::read_position_list().
|
protected |
Definition at line 47 of file leafpostlist.h.