#include <queryoptimiser.h>

Public Member Functions | |
| QueryOptimiser (const Xapian::Database::Internal &db_, LocalSubMatch &localsubmatch_, MultiMatch *matcher_) | |
| PostList * | optimise_query (const Xapian::Query::Internal *query) |
| Xapian::termcount | get_total_subqueries () const |
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_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. | |
| PostList * | do_synonym (const Xapian::Query::Internal *query, double factor) |
| Optimise a synonym Xapian::Query::Internal subtree into a PostList. | |
Private Attributes | |
| const Xapian::Database::Internal & | db |
| Xapian::doccount | db_size |
| LocalSubMatch & | localsubmatch |
| MultiMatch * | matcher |
| Xapian::termcount | total_subqs |
| How many leaf subqueries there are. | |
Definition at line 38 of file queryoptimiser.h.
| QueryOptimiser::QueryOptimiser | ( | const Xapian::Database::Internal & | db_, | |
| LocalSubMatch & | localsubmatch_, | |||
| MultiMatch * | matcher_ | |||
| ) | [inline] |
Definition at line 108 of file queryoptimiser.h.
| 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. |
Definition at line 224 of file queryoptimiser.cc.
References Assert, AssertRel, db, do_and_like(), do_subquery(), Xapian::Database::Internal::has_positions(), is_and_like(), LOGCALL_VOID, Xapian::Query::Internal::op, Xapian::Query::OP_AND, Xapian::Query::OP_FILTER, Xapian::Query::OP_NEAR, Xapian::Query::OP_PHRASE, Xapian::Query::Internal::parameter, and Xapian::Query::Internal::subqs.
| 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 179 of file queryoptimiser.cc.
References AssertEq, AssertRel, PosFilter::begin, db_size, PosFilter::end, LOGCALL, matcher, PosFilter::op, Xapian::Query::OP_NEAR, Xapian::Query::OP_PHRASE, RETURN, and PosFilter::window.
Referenced by do_and_like(), and do_subquery().
| 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 332 of file queryoptimiser.cc.
References Assert, AssertRel, db_size, do_subquery(), LOGCALL, matcher, Xapian::Query::Internal::op, Xapian::Query::OP_ELITE_SET, Xapian::Query::OP_OR, Xapian::Query::OP_SYNONYM, Xapian::Query::OP_XOR, Xapian::Query::Internal::parameter, Xapian::PostingIterator::Internal::recalc_maxweight(), RETURN, and Xapian::Query::Internal::subqs.
Referenced by do_subquery(), and do_synonym().
| 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, do_and_like(), do_or_like(), do_synonym(), Xapian::Query::Internal::external_source, Xapian::Query::Internal::get_dbl_parameter(), Xapian::Database::Internal::get_value_lower_bound(), Xapian::Database::Internal::get_value_upper_bound(), localsubmatch, LOGCALL, matcher, Xapian::Query::Internal::op, Xapian::Query::OP_AND, Xapian::Query::OP_AND_MAYBE, Xapian::Query::OP_AND_NOT, Xapian::Query::OP_ELITE_SET, Xapian::Query::Internal::OP_EXTERNAL_SOURCE, 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_SYNONYM, Xapian::Query::OP_VALUE_GE, Xapian::Query::OP_VALUE_LE, Xapian::Query::OP_VALUE_RANGE, Xapian::Query::OP_XOR, Xapian::Query::Internal::parameter, LocalSubMatch::postlist_from_op_leaf_query(), RETURN, Xapian::Query::Internal::str_parameter, Xapian::Query::Internal::subqs, Xapian::Query::Internal::tname, and total_subqs.
Referenced by do_and_like(), do_or_like(), and optimise_query().
| PostList * QueryOptimiser::do_synonym | ( | const Xapian::Query::Internal * | query, | |
| double | factor | |||
| ) | [private] |
Optimise a synonym Xapian::Query::Internal subtree into a PostList.
| query | The subtree to optimise. | |
| factor | How much to scale weights for this subtree by. |
Definition at line 419 of file queryoptimiser.cc.
References AssertEq, do_or_like(), Xapian::Query::Internal::get_wqf(), localsubmatch, LOGCALL, LocalSubMatch::make_synonym_postlist(), matcher, and RETURN.
Referenced by do_subquery().
| Xapian::termcount QueryOptimiser::get_total_subqueries | ( | ) | const [inline] |
Definition at line 118 of file queryoptimiser.h.
References total_subqs.
Referenced by LocalSubMatch::get_postlist_and_term_info().
| PostList* QueryOptimiser::optimise_query | ( | const Xapian::Query::Internal * | query | ) | [inline] |
Definition at line 114 of file queryoptimiser.h.
References do_subquery().
Referenced by LocalSubMatch::get_postlist_and_term_info().
const Xapian::Database::Internal& QueryOptimiser::db [private] |
Xapian::doccount QueryOptimiser::db_size [private] |
Definition at line 41 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 45 of file queryoptimiser.h.
Referenced by do_and_like(), do_or_like(), do_subquery(), and do_synonym().
Xapian::termcount QueryOptimiser::total_subqs [private] |
How many leaf subqueries there are.
Used for scaling percentages when the highest weighted document doesn't "match all terms".
Definition at line 52 of file queryoptimiser.h.
Referenced by do_subquery(), and get_total_subqueries().