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


lucene::search::Query Class Reference

The abstract base class for queries. More...

#include <Query.h>

Inheritance diagram for lucene::search::Query:

lucene::search::BooleanQuery lucene::search::MultiTermQuery lucene::search::PhraseQuery lucene::search::PrefixQuery lucene::search::RangeQuery lucene::search::TermQuery lucene::search::FuzzyQuery lucene::search::WildcardQuery

Public Member Functions

 Query ()
virtual ~Query ()
void setBoost (float_t b)
 Sets the boost for this query clause to b.
float_t getBoost () const
 Gets the boost for this clause.
Weightweight (Searcher *searcher)
 Expert: Constructs an initializes a Weight for a top-level query.
virtual Queryrewrite (lucene::index::IndexReader *reader)
 Expert: called to re-write queries into primitive queries.
virtual Querycombine (Query **queries)
 Expert: called when re-writing queries under MultiSearcher.
SimilaritygetSimilarity (Searcher *searcher)
 Expert: Returns the Similarity implementation to be used for this query.
virtual Queryclone () const =0
 Returns a clone of this query.
virtual const TCHAR * getQueryName () const =0
bool instanceOf (const TCHAR *other) const
virtual TCHAR * toString (const TCHAR *field) const =0
 Prints a query to a string, with field assumed to be the default field and omitted.
virtual bool equals (Query *other) const =0
virtual size_t hashCode () const =0
TCHAR * toString () const
 Prints a query to a string.
virtual Weight_createWeight (Searcher *searcher)
 Expert: Constructs an appropriate Weight implementation for this query.

Static Public Member Functions

static QuerymergeBooleanQueries (Query **queries)
 Expert: merges the clauses of a set of BooleanQuery's into a single BooleanQuery.

Protected Member Functions

 Query (const Query &clone)

Detailed Description

The abstract base class for queries.

Instantiable subclasses are:

A parser for queries is contained in:


Constructor & Destructor Documentation

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

lucene::search::Query::Query (  ) 

virtual lucene::search::Query::~Query (  )  [virtual]


Member Function Documentation

void lucene::search::Query::setBoost ( float_t  b  ) 

Sets the boost for this query clause to b.

Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b.

float_t lucene::search::Query::getBoost (  )  const

Gets the boost for this clause.

Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b. The boost is 1.0 by default.

Weight* lucene::search::Query::weight ( Searcher searcher  ) 

Expert: Constructs an initializes a Weight for a top-level query.

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

virtual Query* lucene::search::Query::combine ( Query **  queries  )  [virtual]

Expert: called when re-writing queries under MultiSearcher.

Only implemented by derived queries, with no _createWeight(Searcher) implementatation.

Reimplemented in lucene::search::MultiTermQuery, lucene::search::PrefixQuery, and lucene::search::RangeQuery.

static Query* lucene::search::Query::mergeBooleanQueries ( Query **  queries  )  [static]

Expert: merges the clauses of a set of BooleanQuery's into a single BooleanQuery.

A utility for use by combine(Query[]) implementations.

Similarity* lucene::search::Query::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 in lucene::search::BooleanQuery.

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

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

bool lucene::search::Query::instanceOf ( const TCHAR *  other  )  const

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

Prints a query to a string, with field assumed to be the default field and omitted.

The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:

  • If the query was created by the parser, the printed representation may not be exactly what was parsed. For example, characters that need to be escaped will be represented without the required backslash.
  • Some of the more complicated queries (e.g. span queries) don't have a representation that can be parsed by QueryParser.

Implemented in lucene::search::BooleanQuery, lucene::search::FuzzyQuery, lucene::search::MultiTermQuery, lucene::search::PhraseQuery, lucene::search::PrefixQuery, lucene::search::RangeQuery, and lucene::search::TermQuery.

virtual bool lucene::search::Query::equals ( Query other  )  const [pure virtual]

virtual size_t lucene::search::Query::hashCode (  )  const [pure virtual]

TCHAR* lucene::search::Query::toString (  )  const

Prints a query to a string.

virtual Weight* lucene::search::Query::_createWeight ( Searcher searcher  )  [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 in lucene::search::BooleanQuery, lucene::search::PhraseQuery, and lucene::search::TermQuery.


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

clucene.sourceforge.net