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


lucene::search::Query Class Reference

The abstract base class for queries. More...

#include <SearchHeader.h>

Inheritance diagram for lucene::search::Query:
lucene::debug::LuceneBase lucene::search::BooleanQuery lucene::search::MultiTermQuery lucene::search::PhraseQuery lucene::search::PrefixQuery lucene::search::RangeQuery lucene::search::TermQuery lucene::search::FuzzyQuery lucene::search::WildcardQuery

List of all members.

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 as the default field for terms.
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

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.

virtual Query* lucene::search::Query::clone (  )  const [pure 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.

virtual bool lucene::search::Query::equals ( Query other  )  const [pure virtual]
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.

virtual const TCHAR* lucene::search::Query::getQueryName (  )  const [pure virtual]
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.

virtual size_t lucene::search::Query::hashCode (  )  const [pure virtual]
bool lucene::search::Query::instanceOf ( const TCHAR *  other  )  const
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.

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

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

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

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.

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

Prints a query to a string.

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

Prints a query to a string, with field as the default field for terms.

The representation used is one that is readable by QueryParser (although, if the query was created by the parser, the printed representation may not be exactly what was parsed).

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

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

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


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

clucene.sourceforge.net