CLucene - a full-featured, c++ search engine
API Documentation
#include <QueryParser.h>
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::Query * | parse (const TCHAR *query) |
Returns a parsed Query instance. | |
virtual lucene::search::Query * | parse (lucene::util::Reader *reader) |
Returns a parsed Query instance. | |
lucene::analysis::Analyzer * | getAnalyzer () |
const TCHAR * | getField () |
void | setLowercaseWildcardTerms (bool lowercaseWildcardTerms) |
bool | getLowercaseWildcardTerms () const |
Static Public Member Functions | |
static lucene::search::Query * | parse (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. |
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.
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 | ( | ) |
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
query | The query value to be parsed. |
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
reader | The TextReader value to be parsed. |
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 | ( | ) |
void lucene::queryParser::QueryParser::setLowercaseWildcardTerms | ( | bool | lowercaseWildcardTerms | ) |
bool lucene::queryParser::QueryParser::getLowercaseWildcardTerms | ( | ) | const |