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


lucene::queryParser::QueryParser Class Reference

CLucene's default query parser. More...

#include <QueryParser.h>

Inheritance diagram for lucene::queryParser::QueryParser:

lucene::queryParser::QueryParserBase lucene::queryParser::MultiFieldQueryParser

Public Member Functions

 QueryParser (const TCHAR *field, lucene::analysis::Analyzer *analyzer)
 Initializes a new instance of the QueryParser class with a specified field and analyzer values.
 ~QueryParser ()
virtual lucene::search::Queryparse (const TCHAR *query)
 Returns a parsed Query instance.
virtual lucene::search::Queryparse (lucene::util::Reader *reader)
 Returns a parsed Query instance.
lucene::analysis::AnalyzergetAnalyzer ()
const TCHAR * getField ()
void setLowercaseWildcardTerms (bool lowercaseWildcardTerms)
bool getLowercaseWildcardTerms () const

Static Public Member Functions

static lucene::search::Queryparse (const TCHAR *query, const TCHAR *field, lucene::analysis::Analyzer *analyzer)
 Returns a new instance of the Query class with a specified query, field and analyzer values.

Detailed Description

CLucene's default query parser.

It's a query parser. The only method that clients should need to call is Parse(). The syntax for query const TCHAR*s is as follows: A Query is a series of clauses. A clause may be prefixed by:

A clause may be either:

Thus, in BNF, the query grammar is: Query ::= ( Clause )* Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )

Examples of appropriately formatted queries can be found in the test cases.


Constructor & Destructor Documentation

lucene::queryParser::QueryParser::QueryParser ( const TCHAR *  field,
lucene::analysis::Analyzer analyzer 
)

Initializes a new instance of the QueryParser class with a specified field and analyzer values.

lucene::queryParser::QueryParser::~QueryParser (  ) 


Member Function Documentation

virtual lucene:: search ::Query* lucene::queryParser::QueryParser::parse ( const TCHAR *  query  )  [virtual]

Returns a parsed Query instance.

Note: this call is not threadsafe, either use a seperate QueryParser for each thread, or use a thread lock

Parameters:
query The query value to be parsed.
Returns:
A parsed Query instance.

virtual lucene:: search ::Query* lucene::queryParser::QueryParser::parse ( lucene::util::Reader reader  )  [virtual]

Returns a parsed Query instance.

Note: this call is not threadsafe, either use a seperate QueryParser for each thread, or use a thread lock

Parameters:
reader The TextReader value to be parsed.
Returns:
A parsed Query instance.

static lucene:: search ::Query* lucene::queryParser::QueryParser::parse ( const TCHAR *  query,
const TCHAR *  field,
lucene::analysis::Analyzer analyzer 
) [static]

Returns a new instance of the Query class with a specified query, field and analyzer values.

lucene:: analysis ::Analyzer* lucene::queryParser::QueryParser::getAnalyzer (  )  [inline]

const TCHAR* lucene::queryParser::QueryParser::getField (  ) 

Returns:
Returns the field.

void lucene::queryParser::QueryParser::setLowercaseWildcardTerms ( bool  lowercaseWildcardTerms  ) 

bool lucene::queryParser::QueryParser::getLowercaseWildcardTerms (  )  const


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

clucene.sourceforge.net