#include <queryoptimiser.h>
Collaboration diagram for QueryOptimiser:
Public Member Functions | |
QueryOptimiser (const Xapian::Database::Internal &db_, LocalSubMatch &localsubmatch_, MultiMatch *matcher_) | |
PostList * | optimise_query (Xapian::Query::Internal *query) |
Private Member Functions | |
PostList * | do_subquery (const Xapian::Query::Internal *query, double factor) |
Optimise a Xapian::Query::Internal subtree into a PostList subtree. | |
PostList * | do_leaf (const Xapian::Query::Internal *query, double factor) |
Optimise a leaf Xapian::Query::Internal subtree into a PostList. | |
PostList * | do_and_like (const Xapian::Query::Internal *query, double factor) |
Optimise an AND-like Xapian::Query::Internal subtree into a PostList subtree. | |
void | do_and_like (const Xapian::Query::Internal *query, double factor, std::vector< PostList * > &and_plists, std::list< PosFilter > &pos_filters) |
Optimise an AND-like Xapian::Query::Internal subtree into a PostList subtree. | |
PostList * | do_or_like (const Xapian::Query::Internal *query, double factor) |
Optimise an OR-like Xapian::Query::Internal subtree into a PostList subtree. | |
Private Attributes | |
const Xapian::Database::Internal & | db |
Xapian::doccount | db_size |
LocalSubMatch & | localsubmatch |
MultiMatch * | matcher |
Definition at line 39 of file queryoptimiser.h.
QueryOptimiser::QueryOptimiser | ( | const Xapian::Database::Internal & | db_, | |
LocalSubMatch & | localsubmatch_, | |||
MultiMatch * | matcher_ | |||
) | [inline] |
Definition at line 105 of file queryoptimiser.h.
PostList * QueryOptimiser::do_subquery | ( | const Xapian::Query::Internal * | query, | |
double | factor | |||
) | [private] |
Optimise a Xapian::Query::Internal subtree into a PostList subtree.
query | The subtree to optimise. | |
factor | How much to scale weights for this subtree by. |
Definition at line 52 of file queryoptimiser.cc.
References Assert, AssertEq, db, db_size, DEBUGCALL, do_and_like(), do_leaf(), do_or_like(), matcher, Xapian::Query::OP_AND, Xapian::Query::OP_AND_MAYBE, Xapian::Query::OP_AND_NOT, Xapian::Query::OP_ELITE_SET, Xapian::Query::OP_FILTER, Xapian::Query::Internal::OP_LEAF, Xapian::Query::OP_NEAR, Xapian::Query::OP_OR, Xapian::Query::OP_PHRASE, Xapian::Query::OP_SCALE_WEIGHT, Xapian::Query::OP_VALUE_GE, Xapian::Query::OP_VALUE_LE, Xapian::Query::OP_VALUE_RANGE, Xapian::Query::OP_XOR, query(), and RETURN.
Referenced by do_or_like(), and optimise_query().
PostList* QueryOptimiser::do_leaf | ( | const Xapian::Query::Internal * | query, | |
double | factor | |||
) | [inline, private] |
Optimise a leaf Xapian::Query::Internal subtree into a PostList.
query | The subtree to optimise. | |
factor | How much to scale weights for this postlist by. |
Definition at line 65 of file queryoptimiser.h.
References Xapian::Query::empty(), localsubmatch, LocalSubMatch::postlist_from_op_leaf_query(), and query().
Referenced by do_subquery().
PostList * QueryOptimiser::do_and_like | ( | const Xapian::Query::Internal * | query, | |
double | factor | |||
) | [private] |
Optimise an AND-like Xapian::Query::Internal subtree into a PostList subtree.
query | The subtree to optimise. | |
factor | How much to scale weights for this subtree by. |
Definition at line 135 of file queryoptimiser.cc.
References AssertEq, AssertRel, db_size, DEBUGCALL, matcher, Xapian::Query::OP_NEAR, Xapian::Query::OP_PHRASE, query(), and RETURN.
Referenced by do_subquery().
void QueryOptimiser::do_and_like | ( | const Xapian::Query::Internal * | query, | |
double | factor, | |||
std::vector< PostList * > & | and_plists, | |||
std::list< PosFilter > & | pos_filters | |||
) | [private] |
Optimise an AND-like Xapian::Query::Internal subtree into a PostList subtree.
query | The subtree to optimise. | |
factor | How much to scale weights for this subtree by. | |
and_plists | Append new PostList subtrees to be combined with AND to this vector. | |
pos_filters | Append any positional filters to be applied to the tree to this list. |
PostList * QueryOptimiser::do_or_like | ( | const Xapian::Query::Internal * | query, | |
double | factor | |||
) | [private] |
Optimise an OR-like Xapian::Query::Internal subtree into a PostList subtree.
query | The subtree to optimise. | |
factor | How much to scale weights for this subtree by. |
Definition at line 288 of file queryoptimiser.cc.
References Assert, AssertRel, db_size, DEBUGCALL, do_subquery(), matcher, Xapian::Query::OP_ELITE_SET, Xapian::Query::OP_OR, Xapian::Query::OP_XOR, query(), Xapian::PostingIterator::Internal::recalc_maxweight(), and RETURN.
Referenced by do_subquery().
PostList* QueryOptimiser::optimise_query | ( | Xapian::Query::Internal * | query | ) | [inline] |
const Xapian::Database::Internal& QueryOptimiser::db [private] |
Xapian::doccount QueryOptimiser::db_size [private] |
Definition at line 42 of file queryoptimiser.h.
Referenced by do_and_like(), do_or_like(), and do_subquery().
LocalSubMatch& QueryOptimiser::localsubmatch [private] |
MultiMatch* QueryOptimiser::matcher [private] |
Definition at line 46 of file queryoptimiser.h.
Referenced by do_and_like(), do_or_like(), and do_subquery().