xapian-core  2.0.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Xapian::Internal::QueryOptimiser Class Reference

#include <queryoptimiser.h>

+ Collaboration diagram for Xapian::Internal::QueryOptimiser:

Public Member Functions

 QueryOptimiser (const Xapian::Database::Internal &db_, LocalSubMatch &localsubmatch_, PostListTree *matcher_, Xapian::doccount shard_index_)
 
 ~QueryOptimiser ()
 
void inc_total_subqs ()
 
Xapian::termcount get_total_subqs () const
 
void set_total_subqs (Xapian::termcount n)
 
bool get_no_estimates () const
 
void set_no_estimates (bool f)
 
PostListAndEstimate open_post_list (const std::string &term, Xapian::termcount wqf, double factor, TermFreqs *termfreqs)
 Create a PostList object for term. More...
 
PostListAndEstimate open_lazy_post_list (const std::string &term, Xapian::termcount wqf, double factor)
 
void register_lazy_postlist_for_stats (LeafPostList *pl, TermFreqs *termfreqs)
 Register a lazily-created LeafPostList for stats. More...
 
PostListAndEstimate make_synonym_postlist (PostListAndEstimate or_pl, double factor, const TermFreqs &termfreqs)
 Create a SynonymPostList object. More...
 
const LeafPostListget_hint_postlist () const
 
void set_hint_postlist (LeafPostList *new_hint)
 
void own_hint_postlist ()
 
void destroy_postlist (PostList *pl)
 
bool need_wdf_for_compound_weight () const
 
const Xapian::Weight::Internalget_stats () const
 

Public Attributes

bool need_positions = false
 
bool compound_weight = false
 
Xapian::doccount shard_index
 
const Xapian::Database::Internaldb
 
Xapian::doccount db_size
 
PostListTreematcher
 

Private Member Functions

void operator= (const QueryOptimiser &)
 Prevent assignment. More...
 
 QueryOptimiser (const QueryOptimiser &)
 Prevent copying. More...
 

Private Attributes

LocalSubMatchlocalsubmatch
 
Xapian::termcount total_subqs = 0
 How many weighted leaf subqueries there are. More...
 
LeafPostListhint = nullptr
 
bool hint_owned = false
 
bool no_estimates = false
 

Detailed Description

Definition at line 36 of file queryoptimiser.h.

Constructor & Destructor Documentation

◆ QueryOptimiser() [1/2]

Xapian::Internal::QueryOptimiser::QueryOptimiser ( const QueryOptimiser )
private

Prevent copying.

◆ QueryOptimiser() [2/2]

Xapian::Internal::QueryOptimiser::QueryOptimiser ( const Xapian::Database::Internal db_,
LocalSubMatch localsubmatch_,
PostListTree matcher_,
Xapian::doccount  shard_index_ 
)
inline

Definition at line 71 of file queryoptimiser.h.

◆ ~QueryOptimiser()

Xapian::Internal::QueryOptimiser::~QueryOptimiser ( )
inline

Definition at line 80 of file queryoptimiser.h.

References hint, and hint_owned.

Member Function Documentation

◆ destroy_postlist()

void Xapian::Internal::QueryOptimiser::destroy_postlist ( PostList pl)
inline

◆ get_hint_postlist()

const LeafPostList* Xapian::Internal::QueryOptimiser::get_hint_postlist ( ) const
inline

Definition at line 146 of file queryoptimiser.h.

References hint.

Referenced by LocalSubMatch::open_post_list().

◆ get_no_estimates()

bool Xapian::Internal::QueryOptimiser::get_no_estimates ( ) const
inline

◆ get_stats()

const Xapian::Weight::Internal* Xapian::Internal::QueryOptimiser::get_stats ( ) const
inline

◆ get_total_subqs()

Xapian::termcount Xapian::Internal::QueryOptimiser::get_total_subqs ( ) const
inline

◆ inc_total_subqs()

void Xapian::Internal::QueryOptimiser::inc_total_subqs ( )
inline

◆ make_synonym_postlist()

PostListAndEstimate Xapian::Internal::QueryOptimiser::make_synonym_postlist ( PostListAndEstimate  or_pl,
double  factor,
const TermFreqs termfreqs 
)
inline

Create a SynonymPostList object.

Parameters
or_plAn unweighted BoolOrPostList or OrPostList of the PostList objects for children of the OP_SYNONYM.
termfreqsEstimated TermFreqs for or_pl.

Definition at line 139 of file queryoptimiser.h.

References localsubmatch, LocalSubMatch::make_synonym_postlist(), and matcher.

Referenced by Xapian::Internal::QueryBranch::do_synonym(), Xapian::Internal::QueryWildcard::postlist(), and Xapian::Internal::QueryEditDistance::postlist().

◆ need_wdf_for_compound_weight()

bool Xapian::Internal::QueryOptimiser::need_wdf_for_compound_weight ( ) const
inline

◆ open_lazy_post_list()

PostListAndEstimate Xapian::Internal::QueryOptimiser::open_lazy_post_list ( const std::string &  term,
Xapian::termcount  wqf,
double  factor 
)
inline

◆ open_post_list()

PostListAndEstimate Xapian::Internal::QueryOptimiser::open_post_list ( const std::string &  term,
Xapian::termcount  wqf,
double  factor,
TermFreqs termfreqs 
)
inline

Create a PostList object for term.

Parameters
[out]termfreqsIf not NULL, the pointed to object is set to the TermFreqs for term. If the database is sharded, these will be for the whole database not just the current shard. This is used to estimate TermFreqs for an OP_SYNONYM.

Definition at line 102 of file queryoptimiser.h.

References compound_weight, localsubmatch, need_positions, LocalSubMatch::open_post_list(), and term.

Referenced by Xapian::Internal::QueryTerm::postlist().

◆ operator=()

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

Prevent assignment.

◆ own_hint_postlist()

void Xapian::Internal::QueryOptimiser::own_hint_postlist ( )
inline

Definition at line 156 of file queryoptimiser.h.

References hint_owned.

Referenced by LocalSubMatch::open_post_list().

◆ register_lazy_postlist_for_stats()

void Xapian::Internal::QueryOptimiser::register_lazy_postlist_for_stats ( LeafPostList pl,
TermFreqs termfreqs 
)
inline

Register a lazily-created LeafPostList for stats.

Parameters
plAn object previously returned by open_lazy_post_list().
[out]termfreqsIf not NULL, the pointed to object is set to the TermFreqs for term. If the database is sharded, these will be for the whole database not just the current shard. This is used to estimate TermFreqs for an OP_SYNONYM.

Definition at line 128 of file queryoptimiser.h.

References localsubmatch, and LocalSubMatch::register_lazy_postlist_for_stats().

◆ set_hint_postlist()

void Xapian::Internal::QueryOptimiser::set_hint_postlist ( LeafPostList new_hint)
inline

Definition at line 148 of file queryoptimiser.h.

References hint, and hint_owned.

Referenced by LocalSubMatch::open_post_list().

◆ set_no_estimates()

void Xapian::Internal::QueryOptimiser::set_no_estimates ( bool  f)
inline

Definition at line 92 of file queryoptimiser.h.

References no_estimates.

Referenced by Xapian::Internal::QueryAndMaybe::postlist_sub_and_like().

◆ set_total_subqs()

void Xapian::Internal::QueryOptimiser::set_total_subqs ( Xapian::termcount  n)
inline

Member Data Documentation

◆ compound_weight

bool Xapian::Internal::QueryOptimiser::compound_weight = false

◆ db

const Xapian::Database::Internal& Xapian::Internal::QueryOptimiser::db

◆ db_size

Xapian::doccount Xapian::Internal::QueryOptimiser::db_size

◆ hint

LeafPostList* Xapian::Internal::QueryOptimiser::hint = nullptr
private

◆ hint_owned

bool Xapian::Internal::QueryOptimiser::hint_owned = false
private

◆ localsubmatch

LocalSubMatch& Xapian::Internal::QueryOptimiser::localsubmatch
private

◆ matcher

PostListTree* Xapian::Internal::QueryOptimiser::matcher

◆ need_positions

bool Xapian::Internal::QueryOptimiser::need_positions = false

◆ no_estimates

bool Xapian::Internal::QueryOptimiser::no_estimates = false
private

Definition at line 56 of file queryoptimiser.h.

Referenced by get_no_estimates(), and set_no_estimates().

◆ shard_index

Xapian::doccount Xapian::Internal::QueryOptimiser::shard_index

Definition at line 63 of file queryoptimiser.h.

Referenced by Xapian::Internal::QueryPostingSource::postlist().

◆ total_subqs

Xapian::termcount Xapian::Internal::QueryOptimiser::total_subqs = 0
private

How many weighted leaf subqueries there are.

Used for scaling percentages when the highest weighted document doesn't "match all terms".

Definition at line 50 of file queryoptimiser.h.

Referenced by get_total_subqs(), inc_total_subqs(), and set_total_subqs().


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