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 (const Xapian::Query::Internal *query)
Xapian::termcount get_total_subqueries () const

Private Member Functions

PostListdo_subquery (const Xapian::Query::Internal *query, double factor)
 Optimise a Xapian::Query::Internal subtree into a PostList subtree.
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.
PostListdo_synonym (const Xapian::Query::Internal *query, double factor)
 Optimise a synonym Xapian::Query::Internal subtree into a PostList.

Private Attributes

const Xapian::Database::Internaldb
Xapian::doccount db_size
LocalSubMatchlocalsubmatch
MultiMatchmatcher
Xapian::termcount total_subqs
 How many leaf subqueries there are.


Detailed Description

Definition at line 38 of file queryoptimiser.h.


Constructor & Destructor Documentation

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

Definition at line 108 of file queryoptimiser.h.


Member Function Documentation

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.

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.

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

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.

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

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]

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

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

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

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().


Member Data Documentation

Definition at line 39 of file queryoptimiser.h.

Referenced by do_and_like(), and do_subquery().

Definition at line 41 of file queryoptimiser.h.

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

Definition at line 43 of file queryoptimiser.h.

Referenced by do_subquery(), and do_synonym().

Definition at line 45 of file queryoptimiser.h.

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

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().


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

Documentation for Xapian (version 1.2.8).
Generated on 14 Dec 2011 by Doxygen 1.5.9.