QueryOptimiser Class Reference

#include <queryoptimiser.h>

Collaboration diagram for QueryOptimiser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 QueryOptimiser (const Xapian::Database::Internal &db_, LocalSubMatch &localsubmatch_, MultiMatch *matcher_)
PostListoptimise_query (Xapian::Query::Internal *query)

Private Member Functions

PostListdo_subquery (const Xapian::Query::Internal *query, double factor)
 Optimise a Xapian::Query::Internal subtree into a PostList subtree.
PostListdo_leaf (const Xapian::Query::Internal *query, double factor)
 Optimise a leaf Xapian::Query::Internal subtree into a PostList.
PostListdo_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.
PostListdo_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::Internaldb
Xapian::doccount db_size
LocalSubMatchlocalsubmatch
MultiMatchmatcher

Detailed Description

Definition at line 39 of file queryoptimiser.h.


Constructor & Destructor Documentation

QueryOptimiser::QueryOptimiser ( const Xapian::Database::Internal db_,
LocalSubMatch localsubmatch_,
MultiMatch matcher_ 
) [inline]

Definition at line 105 of file queryoptimiser.h.


Member Function Documentation

PostList * QueryOptimiser::do_subquery ( const Xapian::Query::Internal query,
double  factor 
) [private]

Optimise a Xapian::Query::Internal subtree into a PostList subtree.

Parameters:
query The subtree to optimise.
factor How much to scale weights for this subtree by.
Returns:
A PostList subtree.

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.

Parameters:
query The subtree to optimise.
factor How much to scale weights for this postlist by.
Returns:
A PostList.

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.

Parameters:
query The subtree to optimise.
factor How much to scale weights for this subtree by.
Returns:
A PostList subtree.

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.

Parameters:
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.

Parameters:
query The subtree to optimise.
factor How much to scale weights for this subtree by.
Returns:
A PostList subtree.

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]

Definition at line 111 of file queryoptimiser.h.

References do_subquery(), and query().


Member Data Documentation

const Xapian::Database::Internal& QueryOptimiser::db [private]

Definition at line 40 of file queryoptimiser.h.

Referenced by do_subquery().

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]

Definition at line 44 of file queryoptimiser.h.

Referenced by do_leaf().

MultiMatch* QueryOptimiser::matcher [private]

Definition at line 46 of file queryoptimiser.h.

Referenced by do_and_like(), do_or_like(), and do_subquery().


The documentation for this class was generated from the following files:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.