CLucene - a full-featured, c++ search engine
API Documentation


lucene::search::BooleanQuery Class Reference

#include <BooleanQuery.h>

Inheritance diagram for lucene::search::BooleanQuery:

lucene::search::Query

Public Types

typedef lucene::util::CLVector
< BooleanClause
*, lucene::util::Deletor::Object
< BooleanClause > > 
ClausesType

Public Member Functions

 BooleanQuery (bool disableCoord=false)
 Constructs an empty boolean query.
 ~BooleanQuery ()
const TCHAR * getQueryName () const
void add (Query *query, const bool required, const bool prohibited)
 Adds a clause to a boolean query.
void add (Query *query, const bool deleteQuery, const bool required, const bool prohibited)
void add (Query *query, const bool deleteQuery, BooleanClause::Occur occur)
void add (Query *query, BooleanClause::Occur occur)
void getClauses (BooleanClause **clauses) const
 Copies the clauses of this query into the array.
BooleanClause ** getClauses () const
size_t getClauseCount () const
 Give client code access to clauses.size() so we know how large the array returned by getClauses is.
void add (BooleanClause *clause)
 Adds a clause to a boolean query.
Queryrewrite (lucene::index::IndexReader *reader)
 Expert: called to re-write queries into primitive queries.
Queryclone () const
 Returns a clone of this query.
bool equals (Query *o) const
SimilaritygetSimilarity (Searcher *searcher)
 Expert: Returns the Similarity implementation to be used for this query.
bool isCoordDisabled ()
void setCoordDisabled (bool disableCoord)
TCHAR * toString (const TCHAR *field) const
 Prints a user-readable version of this query.
size_t hashCode () const
 Returns a hash code value for this object.
int32_t getMinNrShouldMatch ()

Static Public Member Functions

static const TCHAR * getClassName ()
static size_t getMaxClauseCount ()
 Return the maximum number of clauses permitted, 1024 by default.
static void setMaxClauseCount (size_t maxClauseCount)
 Set the maximum number of clauses permitted.
static bool getUseScorer14 ()
static void setUseScorer14 (bool use14)

Protected Member Functions

Weight_createWeight (Searcher *searcher)
 Expert: Constructs an appropriate Weight implementation for this query.
 BooleanQuery (const BooleanQuery &clone)

Protected Attributes

int32_t minNrShouldMatch

Member Typedef Documentation

typedef lucene:: util ::CLVector<BooleanClause*,lucene:: util ::Deletor::Object<BooleanClause> > lucene::search::BooleanQuery::ClausesType


Constructor & Destructor Documentation

lucene::search::BooleanQuery::BooleanQuery ( const BooleanQuery clone  )  [protected]

lucene::search::BooleanQuery::BooleanQuery ( bool  disableCoord = false  ) 

Constructs an empty boolean query.

lucene::search::BooleanQuery::~BooleanQuery (  ) 


Member Function Documentation

Weight* lucene::search::BooleanQuery::_createWeight ( Searcher searcher  )  [protected, virtual]

Expert: Constructs an appropriate Weight implementation for this query.

Only implemented by primitive queries, which re-write to themselves. This is an Internal function

Reimplemented from lucene::search::Query.

const TCHAR* lucene::search::BooleanQuery::getQueryName (  )  const [virtual]

Implements lucene::search::Query.

static const TCHAR* lucene::search::BooleanQuery::getClassName (  )  [static]

static size_t lucene::search::BooleanQuery::getMaxClauseCount (  )  [static]

Return the maximum number of clauses permitted, 1024 by default.

Attempts to add more than the permitted number of clauses cause TooManyClauses to be thrown.

static void lucene::search::BooleanQuery::setMaxClauseCount ( size_t  maxClauseCount  )  [static]

Set the maximum number of clauses permitted.

void lucene::search::BooleanQuery::add ( Query query,
const bool  required,
const bool  prohibited 
) [inline]

Adds a clause to a boolean query.

Clauses may be:

  • required which means that documents which do not match this sub-query will not match the boolean query;
  • prohibited which means that documents which do match this sub-query will not match the boolean query; or
  • neither, in which case matched documents are neither prohibited from nor required to match the sub-query. However, a document must match at least 1 sub-query to match the boolean query.
It is an error to specify a clause as both required and prohibited.

Deprecated:
use add(Query, BooleanClause.Occur) instead:
  • For add(query, true, false) use add(query, BooleanClause.Occur.MUST)
  • For add(query, false, false) use add(query, BooleanClause.Occur.SHOULD)
  • For add(query, false, true) use add(query, BooleanClause.Occur.MUST_NOT)

void lucene::search::BooleanQuery::add ( Query query,
const bool  deleteQuery,
const bool  required,
const bool  prohibited 
)

void lucene::search::BooleanQuery::add ( Query query,
const bool  deleteQuery,
BooleanClause::Occur  occur 
)

void lucene::search::BooleanQuery::add ( Query query,
BooleanClause::Occur  occur 
) [inline]

void lucene::search::BooleanQuery::getClauses ( BooleanClause **  clauses  )  const

Copies the clauses of this query into the array.

The array must be at least as long as getClauseCount() If you want to use the clauses, make sure you null terminate it.

BooleanClause** lucene::search::BooleanQuery::getClauses (  )  const

size_t lucene::search::BooleanQuery::getClauseCount (  )  const

Give client code access to clauses.size() so we know how large the array returned by getClauses is.

void lucene::search::BooleanQuery::add ( BooleanClause clause  ) 

Adds a clause to a boolean query.

See also:
getMaxClauseCount()

Query* lucene::search::BooleanQuery::rewrite ( lucene::index::IndexReader reader  )  [virtual]

Expert: called to re-write queries into primitive queries.

Reimplemented from lucene::search::Query.

Query* lucene::search::BooleanQuery::clone (  )  const [virtual]

Returns a clone of this query.

Implements lucene::search::Query.

bool lucene::search::BooleanQuery::equals ( Query o  )  const [virtual]

Implements lucene::search::Query.

Similarity* lucene::search::BooleanQuery::getSimilarity ( Searcher searcher  ) 

Expert: Returns the Similarity implementation to be used for this query.

Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned.

Reimplemented from lucene::search::Query.

bool lucene::search::BooleanQuery::isCoordDisabled (  ) 

void lucene::search::BooleanQuery::setCoordDisabled ( bool  disableCoord  ) 

static bool lucene::search::BooleanQuery::getUseScorer14 (  )  [static]

static void lucene::search::BooleanQuery::setUseScorer14 ( bool  use14  )  [static]

TCHAR* lucene::search::BooleanQuery::toString ( const TCHAR *  field  )  const [virtual]

Prints a user-readable version of this query.

Implements lucene::search::Query.

size_t lucene::search::BooleanQuery::hashCode (  )  const [virtual]

Returns a hash code value for this object.

Implements lucene::search::Query.

int32_t lucene::search::BooleanQuery::getMinNrShouldMatch (  ) 


Field Documentation


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

clucene.sourceforge.net