xapian-core  2.0.0
Public Types | Public Member Functions | Private Attributes | List of all members
EstimateOp Class Reference

Class for estimating the total number of matching documents. More...

#include <estimateop.h>

+ Collaboration diagram for EstimateOp:

Public Types

enum  op_type {
  KNOWN , DECIDER = 1 , NEAR = 2 , PHRASE = 3 ,
  EXACT_PHRASE = 4 , POSTING_SOURCE , AND , AND_NOT ,
  OR , XOR
}
 

Public Member Functions

 EstimateOp (Xapian::doccount tf_, Xapian::docid first, Xapian::docid last)
 Leaf term. More...
 
 EstimateOp ()
 PostingSource. More...
 
 EstimateOp (Estimates estimates_)
 Value range. More...
 
 EstimateOp (Xapian::doccount tf_)
 Value range degenerate case. More...
 
 EstimateOp (op_type type_, Xapian::docid first, Xapian::docid last, Xapian::VecUniquePtr< EstimateOp > &&sub_estimates_)
 AND, AND_NOT, OR or XOR. More...
 
 EstimateOp (op_type type_, Xapian::docid first, Xapian::docid last, std::unique_ptr< EstimateOp > &&est1, std::unique_ptr< EstimateOp > &&est2)
 AND, AND_NOT, OR or XOR (pair-wise). More...
 
 EstimateOp (op_type type_, EstimateOp *sub_estimate)
 DECIDER, NEAR, PHRASE or EXACT_PHRASE. More...
 
void report_first (Xapian::docid first)
 Report the first docid indexed. More...
 
void report_ratio (Xapian::doccount accepted, Xapian::doccount rejected)
 
void report_range_ratio (Xapian::doccount accepted, Xapian::doccount rejected)
 Adjust static estimates for value range. More...
 
void report_termfreqs (Xapian::doccount min_, Xapian::doccount est, Xapian::doccount max_)
 Fill in estimates for POSTING_SOURCE. More...
 
Estimates resolve (Xapian::doccount db_size, Xapian::docid db_first, Xapian::docid db_last)
 
unsigned get_subquery_count () const
 

Private Attributes

op_type type
 
Estimates estimates
 Estimates. More...
 
Xapian::VecUniquePtr< EstimateOpsub_estimates
 

Detailed Description

Class for estimating the total number of matching documents.

We build a tree of EstimateOp objects which largely follows the Query tree/PostList tree, but there are some differences. Here we only care about the number of matches, so operations which only affect ordering are equivalent, so for example, we use OR here for any of OP_OR, OP_SYNONYM and OP_MAX; OP_AND_MAYBE and its RHS are omitted.

Definition at line 64 of file estimateop.h.

Member Enumeration Documentation

◆ op_type

Enumerator
KNOWN 
DECIDER 
NEAR 
PHRASE 
EXACT_PHRASE 
POSTING_SOURCE 
AND 
AND_NOT 
OR 
XOR 

Definition at line 66 of file estimateop.h.

Constructor & Destructor Documentation

◆ EstimateOp() [1/7]

EstimateOp::EstimateOp ( Xapian::doccount  tf_,
Xapian::docid  first,
Xapian::docid  last 
)
inline

Leaf term.

Definition at line 95 of file estimateop.h.

◆ EstimateOp() [2/7]

EstimateOp::EstimateOp ( )
inline

PostingSource.

Definition at line 100 of file estimateop.h.

◆ EstimateOp() [3/7]

EstimateOp::EstimateOp ( Estimates  estimates_)
inline

Value range.

Definition at line 104 of file estimateop.h.

◆ EstimateOp() [4/7]

EstimateOp::EstimateOp ( Xapian::doccount  tf_)
inline

Value range degenerate case.

Definition at line 108 of file estimateop.h.

◆ EstimateOp() [5/7]

EstimateOp::EstimateOp ( op_type  type_,
Xapian::docid  first,
Xapian::docid  last,
Xapian::VecUniquePtr< EstimateOp > &&  sub_estimates_ 
)
inline

AND, AND_NOT, OR or XOR.

Definition at line 112 of file estimateop.h.

References estimates, Estimates::first, and Estimates::last.

◆ EstimateOp() [6/7]

EstimateOp::EstimateOp ( op_type  type_,
Xapian::docid  first,
Xapian::docid  last,
std::unique_ptr< EstimateOp > &&  est1,
std::unique_ptr< EstimateOp > &&  est2 
)
inline

AND, AND_NOT, OR or XOR (pair-wise).

Definition at line 120 of file estimateop.h.

References estimates, Estimates::first, Estimates::last, and sub_estimates.

◆ EstimateOp() [7/7]

EstimateOp::EstimateOp ( op_type  type_,
EstimateOp sub_estimate 
)
inline

DECIDER, NEAR, PHRASE or EXACT_PHRASE.

These operate as filters so have a single subquery.

Definition at line 134 of file estimateop.h.

References sub_estimates.

Member Function Documentation

◆ get_subquery_count()

unsigned EstimateOp::get_subquery_count ( ) const
inline

Definition at line 201 of file estimateop.h.

References sub_estimates.

◆ report_first()

void EstimateOp::report_first ( Xapian::docid  first)
inline

Report the first docid indexed.

Called by ValueRangePostList if it starts with next().

Definition at line 143 of file estimateop.h.

References estimates, and Estimates::first.

◆ report_range_ratio()

void EstimateOp::report_range_ratio ( Xapian::doccount  accepted,
Xapian::doccount  rejected 
)
inline

Adjust static estimates for value range.

Definition at line 158 of file estimateop.h.

References AssertEq, AssertRel, Estimates::est, estimates, KNOWN, Estimates::max, Estimates::min, and type.

◆ report_ratio()

void EstimateOp::report_ratio ( Xapian::doccount  accepted,
Xapian::doccount  rejected 
)
inline

◆ report_termfreqs()

void EstimateOp::report_termfreqs ( Xapian::doccount  min_,
Xapian::doccount  est,
Xapian::doccount  max_ 
)
inline

Fill in estimates for POSTING_SOURCE.

Definition at line 186 of file estimateop.h.

References AssertEq, Estimates::est, estimates, Estimates::first, Estimates::last, Estimates::max, Estimates::min, POSTING_SOURCE, and type.

Referenced by ExternalPostList::ExternalPostList().

◆ resolve()

Estimates EstimateOp::resolve ( Xapian::doccount  db_size,
Xapian::docid  db_first,
Xapian::docid  db_last 
)

Member Data Documentation

◆ estimates

Estimates EstimateOp::estimates
private

Estimates.

  • KNOWN: Already known exact leaf term frequency (in min/est/max) or value range min/est/max based on static information (which is adjusted by a call to report_range_ratio()).
  • DECIDER/NEAR/PHRASE/EXACT_PHRASE: Filled in on PostList deletion by calling report_ratio(): min = accepted, max = rejected
  • POSTING_SOURCE: Filled in on PostList construction with min/est/max from PostingSource object.

Definition at line 89 of file estimateop.h.

Referenced by EstimateOp(), report_first(), report_range_ratio(), report_ratio(), and report_termfreqs().

◆ sub_estimates

Xapian::VecUniquePtr<EstimateOp> EstimateOp::sub_estimates
private

Definition at line 91 of file estimateop.h.

Referenced by EstimateOp(), and get_subquery_count().

◆ type

op_type EstimateOp::type
private

Definition at line 77 of file estimateop.h.

Referenced by report_range_ratio(), report_ratio(), and report_termfreqs().


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