|
| MultiFieldQueryParser (LuceneVersion::Version matchVersion, Collection< String > fields, AnalyzerPtr analyzer, MapStringDouble boosts) |
| Creates a MultiFieldQueryParser. Allows passing of a map with term to Boost, and the boost to apply to each term. More...
|
|
| MultiFieldQueryParser (LuceneVersion::Version matchVersion, Collection< String > fields, AnalyzerPtr analyzer) |
| Creates a MultiFieldQueryParser. It will, when parse(String query) is called, construct a query like this (assuming the query consists of two terms and you specify the two fields title and body): More...
|
|
virtual | ~MultiFieldQueryParser () |
|
virtual String | getClassName () |
|
boost::shared_ptr
< MultiFieldQueryParser > | shared_from_this () |
|
| QueryParser (LuceneVersion::Version matchVersion, const String &field, AnalyzerPtr analyzer) |
| Constructs a query parser. More...
|
|
| QueryParser (QueryParserCharStreamPtr stream) |
| Constructor with user supplied QueryParserCharStream. More...
|
|
| QueryParser (QueryParserTokenManagerPtr tokenMgr) |
| Constructor with generated Token Manager. More...
|
|
virtual | ~QueryParser () |
|
boost::shared_ptr< QueryParser > | shared_from_this () |
|
QueryPtr | parse (const String &query) |
| Parses a query string, returning a Query. More...
|
|
AnalyzerPtr | getAnalyzer () |
|
String | getField () |
|
double | getFuzzyMinSim () |
| Get the minimal similarity for fuzzy queries. More...
|
|
void | setFuzzyMinSim (double fuzzyMinSim) |
| Set the minimum similarity for fuzzy queries. Default is 0.5. More...
|
|
int32_t | getFuzzyPrefixLength () |
| Get the prefix length for fuzzy queries. More...
|
|
void | setFuzzyPrefixLength (int32_t fuzzyPrefixLength) |
| Set the prefix length for fuzzy queries. Default is 0. More...
|
|
void | setPhraseSlop (int32_t phraseSlop) |
| Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero. More...
|
|
int32_t | getPhraseSlop () |
| Gets the default slop for phrases. More...
|
|
void | setAllowLeadingWildcard (bool allowLeadingWildcard) |
| Set to true to allow leading wildcard characters. More...
|
|
bool | getAllowLeadingWildcard () |
|
void | setEnablePositionIncrements (bool enable) |
| Set to true to enable position increments in result query. More...
|
|
bool | getEnablePositionIncrements () |
|
void | setDefaultOperator (Operator op) |
| Sets the boolean operator of the QueryParser. In default mode (OR_OPERATOR) terms without any modifiers are considered optional: for example capital of Hungary is equal to capital OR of OR Hungary. In AND_OPERATOR mode terms are considered to be in conjunction: the above mentioned query is parsed as capital AND of AND Hungary. More...
|
|
Operator | getDefaultOperator () |
| Gets implicit operator setting, which will be either AND_OPERATOR or OR_OPERATOR. More...
|
|
void | setLowercaseExpandedTerms (bool lowercaseExpandedTerms) |
| Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is true. More...
|
|
bool | getLowercaseExpandedTerms () |
|
void | setMultiTermRewriteMethod (RewriteMethodPtr method) |
| By default QueryParser uses MultiTermQuery#CONSTANT_SCORE_AUTO_REWRITE_DEFAULT when creating a PrefixQuery, WildcardQuery or RangeQuery. This implementation is generally preferable because it a) Runs faster b) Does not have the scarcity of terms unduly influence score c) avoids any "TooManyClauses" exception. However, if your application really needs to use the old- fashioned BooleanQuery expansion rewriting and the above points are not relevant then use this to change the rewrite method. More...
|
|
RewriteMethodPtr | getMultiTermRewriteMethod () |
|
void | setLocale (std::locale locale) |
| Set locale used by date range parsing. More...
|
|
std::locale | getLocale () |
| Returns current locale, allowing access by subclasses. More...
|
|
void | setDateResolution (DateTools::Resolution dateResolution) |
| Sets the default date resolution used by RangeQueries for fields for which no specific date resolutions has been set. Field specific resolutions can be set with setDateResolution(const String&, DateTools::Resolution). More...
|
|
void | setDateResolution (const String &fieldName, DateTools::Resolution dateResolution) |
| Sets the date resolution used by RangeQueries for a specific field. More...
|
|
DateTools::Resolution | getDateResolution (const String &fieldName) |
| Returns the date resolution that is used by RangeQueries for the given field. Returns null, if no default or field specific date resolution has been set for the given field. More...
|
|
void | setRangeCollator (CollatorPtr rc) |
| Sets the collator used to determine index term inclusion in ranges for RangeQuerys. More...
|
|
CollatorPtr | getRangeCollator () |
|
int32_t | Conjunction () |
| Query ::= ( Clause )* Clause ::= ["+", "-"] [ ":"] ( | "(" Query ")" ) More...
|
|
int32_t | Modifiers () |
|
virtual QueryPtr | TopLevelQuery (const String &field) |
| This makes sure that there is no garbage after the query string. More...
|
|
virtual QueryPtr | ParseQuery (const String &field) |
|
virtual QueryPtr | ParseClause (const String &field) |
|
virtual QueryPtr | ParseTerm (const String &field) |
|
virtual void | ReInit (QueryParserCharStreamPtr stream) |
| Reinitialise. More...
|
|
virtual void | ReInit (QueryParserTokenManagerPtr tokenMgr) |
| Reinitialise. More...
|
|
virtual QueryParserTokenPtr | getNextToken () |
| Get the next Token. More...
|
|
virtual QueryParserTokenPtr | getToken (int32_t index) |
| Get the specific Token. More...
|
|
virtual void | generateParseException () |
| Generate QueryParserError exception. More...
|
|
virtual void | enable_tracing () |
| Enable tracing. More...
|
|
virtual void | disable_tracing () |
| Disable tracing. More...
|
|
virtual | ~QueryParserConstants () |
|
virtual | ~LuceneObject () |
|
virtual void | initialize () |
| Called directly after instantiation to create objects that depend on this object being fully constructed. More...
|
|
virtual LuceneObjectPtr | clone (LuceneObjectPtr other=LuceneObjectPtr()) |
| Return clone of this object. More...
|
|
virtual int32_t | hashCode () |
| Return hash code for this object. More...
|
|
virtual bool | equals (LuceneObjectPtr other) |
| Return whether two objects are equal. More...
|
|
virtual int32_t | compareTo (LuceneObjectPtr other) |
| Compare two objects. More...
|
|
virtual String | toString () |
| Returns a string representation of the object. More...
|
|
virtual | ~LuceneSync () |
|
virtual SynchronizePtr | getSync () |
| Return this object synchronize lock. More...
|
|
virtual LuceneSignalPtr | getSignal () |
| Return this object signal. More...
|
|
virtual void | lock (int32_t timeout=0) |
| Lock this object using an optional timeout. More...
|
|
virtual void | unlock () |
| Unlock this object. More...
|
|
virtual bool | holdsLock () |
| Returns true if this object is currently locked by current thread. More...
|
|
virtual void | wait (int32_t timeout=0) |
| Wait for signal using an optional timeout. More...
|
|
virtual void | notifyAll () |
| Notify all threads waiting for signal. More...
|
|
|
virtual QueryPtr | getFieldQuery (const String &field, const String &queryText, int32_t slop) |
| Base implementation delegates to getFieldQuery(const String&, const String&). This method may be overridden, for example, to return a SpanNearQuery instead of a PhraseQuery. More...
|
|
virtual QueryPtr | getFieldQuery (const String &field, const String &queryText) |
| Use the analyzer to get all the tokens, and then build a TermQuery, PhraseQuery, or nothing based on the term count. More...
|
|
void | applySlop (QueryPtr query, int32_t slop) |
|
virtual QueryPtr | getFuzzyQuery (const String &field, const String &termStr, double minSimilarity) |
| Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an input term token that has the fuzzy suffix (~) appended. More...
|
|
virtual QueryPtr | getPrefixQuery (const String &field, const String &termStr) |
| Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an input term token that uses prefix notation; that is, contains a single '*' wildcard character as its last character. Since this is a special case of generic wildcard term, and such a query can be optimized easily, this usually results in a different query object. More...
|
|
virtual QueryPtr | getWildcardQuery (const String &field, const String &termStr) |
| Factory method for generating a query. Called when parser parses an input term token that contains one or more wildcard characters (? and *), but is not a prefix term token (one that has just a single * character at the end) More...
|
|
virtual QueryPtr | getRangeQuery (const String &field, const String &part1, const String &part2, bool inclusive) |
| Builds a new TermRangeQuery instance for given min/max parts. More...
|
|
void | ConstructParser (QueryParserCharStreamPtr stream, QueryParserTokenManagerPtr tokenMgr) |
| Construct query parser with supplied QueryParserCharStream or TokenManager. More...
|
|
virtual void | addClause (Collection< BooleanClausePtr > clauses, int32_t conj, int32_t mods, QueryPtr q) |
|
BooleanQueryPtr | newBooleanQuery (bool disableCoord) |
| Builds a new BooleanQuery instance. More...
|
|
BooleanClausePtr | newBooleanClause (QueryPtr q, BooleanClause::Occur occur) |
| Builds a new BooleanClause instance. More...
|
|
QueryPtr | newTermQuery (TermPtr term) |
| Builds a new TermQuery instance. More...
|
|
PhraseQueryPtr | newPhraseQuery () |
| Builds a new PhraseQuery instance. More...
|
|
MultiPhraseQueryPtr | newMultiPhraseQuery () |
| Builds a new MultiPhraseQuery instance. More...
|
|
QueryPtr | newPrefixQuery (TermPtr prefix) |
| Builds a new PrefixQuery instance. More...
|
|
QueryPtr | newFuzzyQuery (TermPtr term, double minimumSimilarity, int32_t prefixLength) |
| Builds a new FuzzyQuery instance. More...
|
|
QueryPtr | newRangeQuery (const String &field, const String &part1, const String &part2, bool inclusive) |
| Builds a new TermRangeQuery instance. More...
|
|
QueryPtr | newMatchAllDocsQuery () |
| Builds a new MatchAllDocsQuery instance. More...
|
|
QueryPtr | newWildcardQuery (TermPtr term) |
| Builds a new WildcardQuery instance. More...
|
|
virtual QueryPtr | getBooleanQuery (Collection< BooleanClausePtr > clauses) |
| Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in. More...
|
|
virtual QueryPtr | getBooleanQuery (Collection< BooleanClausePtr > clauses, bool disableCoord) |
| Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in. More...
|
|
String | discardEscapeChar (const String &input) |
| Returns a String where the escape char has been removed, or kept only once if there was a double escape. Supports escaped unicode characters, eg. translates \u0041 to A. More...
|
|
bool | jj_2_1 (int32_t xla) |
|
bool | jj_3R_2 () |
|
bool | jj_3_1 () |
|
bool | jj_3R_3 () |
|
QueryParserTokenPtr | jj_consume_token (int32_t kind) |
|
bool | jj_scan_token (int32_t kind) |
|
int32_t | jj_ntk () |
|
void | jj_add_error_token (int32_t kind, int32_t pos) |
|
void | jj_rescan_token () |
|
void | jj_save (int32_t index, int32_t xla) |
|
| QueryParserConstants () |
|
| LuceneObject () |
|
A QueryParser which constructs queries to search multiple fields.
Creates a MultiFieldQueryParser. Allows passing of a map with term to Boost, and the boost to apply to each term.
It will, when parse(String query) is called, construct a query like this (assuming the query consists of two terms and you specify the two fields title and body):
(title:term1 body:term1) (title:term2 body:term2)
When setDefaultOperator(AND_OPERATOR) is set, the result will be:
+(title:term1 body:term1) +(title:term2 body:term2)
When you pass a boost (title=>5 body=>10) you can get:
+(title:term1^5.0 body:term1^10.0) +(title:term2^5.0 body:term2^10.0)
In other words, all the query's terms must appear, but it doesn't matter in what fields they appear.
virtual QueryPtr Lucene::MultiFieldQueryParser::getPrefixQuery |
( |
const String & |
field, |
|
|
const String & |
termStr |
|
) |
| |
|
protectedvirtual |
Factory method for generating a query (similar to getWildcardQuery). Called when parser parses an input term token that uses prefix notation; that is, contains a single '*' wildcard character as its last character. Since this is a special case of generic wildcard term, and such a query can be optimized easily, this usually results in a different query object.
Depending on settings, a prefix term may be lower-cased automatically. It will not go through the default Analyzer, however, since normal Analyzers are unlikely to work properly with wildcard templates.
Can be overridden by extending classes, to provide custom handling for wild card queries, which may be necessary due to missing analyzer calls.
- Parameters
-
field | Name of the field query will use. |
termStr | Term token to use for building term for the query (without trailing '*' character) |
- Returns
- Resulting Query built for the term
Reimplemented from Lucene::QueryParser.