|
| MultiFieldQueryParser (LuceneVersion::Version matchVersion, Collection< String > fields, const AnalyzerPtr &analyzer, MapStringDouble boosts) |
| Creates a MultiFieldQueryParser. Allows passing of a map with term to Boost, and the boost to apply to each term.
|
|
| MultiFieldQueryParser (LuceneVersion::Version matchVersion, Collection< String > fields, const 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):
|
|
virtual | ~MultiFieldQueryParser () |
|
virtual String | getClassName () |
|
boost::shared_ptr< MultiFieldQueryParser > | shared_from_this () |
|
QueryPtr | parse (const String &query) |
| Parses a query string, returning a Query .
|
|
| QueryParser (LuceneVersion::Version matchVersion, const String &field, const AnalyzerPtr &analyzer) |
| Constructs a query parser.
|
|
| QueryParser (const QueryParserCharStreamPtr &stream) |
| Constructor with user supplied QueryParserCharStream.
|
|
| QueryParser (const QueryParserTokenManagerPtr &tokenMgr) |
| Constructor with generated Token Manager.
|
|
virtual | ~QueryParser () |
|
boost::shared_ptr< QueryParser > | shared_from_this () |
|
QueryPtr | parse (const String &query) |
| Parses a query string, returning a Query .
|
|
AnalyzerPtr | getAnalyzer () |
|
String | getField () |
|
double | getFuzzyMinSim () |
| Get the minimal similarity for fuzzy queries.
|
|
void | setFuzzyMinSim (double fuzzyMinSim) |
| Set the minimum similarity for fuzzy queries. Default is 0.5.
|
|
int32_t | getFuzzyPrefixLength () |
| Get the prefix length for fuzzy queries.
|
|
void | setFuzzyPrefixLength (int32_t fuzzyPrefixLength) |
| Set the prefix length for fuzzy queries. Default is 0.
|
|
void | setPhraseSlop (int32_t phraseSlop) |
| Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.
|
|
int32_t | getPhraseSlop () |
| Gets the default slop for phrases.
|
|
void | setAllowLeadingWildcard (bool allowLeadingWildcard) |
| Set to true to allow leading wildcard characters.
|
|
bool | getAllowLeadingWildcard () |
|
void | setEnablePositionIncrements (bool enable) |
| Set to true to enable position increments in result query.
|
|
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.
|
|
Operator | getDefaultOperator () |
| Gets implicit operator setting, which will be either AND_OPERATOR or OR_OPERATOR.
|
|
void | setLowercaseExpandedTerms (bool lowercaseExpandedTerms) |
| Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is true.
|
|
bool | getLowercaseExpandedTerms () |
|
void | setMultiTermRewriteMethod (const 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.
|
|
RewriteMethodPtr | getMultiTermRewriteMethod () |
|
void | setLocale (std::locale locale) |
| Set locale used by date range parsing.
|
|
std::locale | getLocale () |
| Returns current locale, allowing access by subclasses.
|
|
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) .
|
|
void | setDateResolution (const String &fieldName, DateTools::Resolution dateResolution) |
| Sets the date resolution used by RangeQueries for a specific field.
|
|
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.
|
|
void | setRangeCollator (const CollatorPtr &rc) |
| Sets the collator used to determine index term inclusion in ranges for RangeQuerys.
|
|
CollatorPtr | getRangeCollator () |
|
int32_t | Conjunction () |
| Query ::= ( Clause )* Clause ::= ["+", "-"] [ ":"] ( | "(" Query ")" )
|
|
int32_t | Modifiers () |
|
virtual QueryPtr | TopLevelQuery (const String &field) |
| This makes sure that there is no garbage after the query string.
|
|
virtual QueryPtr | ParseQuery (const String &field) |
|
virtual QueryPtr | ParseClause (const String &field) |
|
virtual QueryPtr | ParseTerm (const String &field) |
|
virtual void | ReInit (const QueryParserCharStreamPtr &stream) |
| Reinitialise.
|
|
virtual void | ReInit (const QueryParserTokenManagerPtr &tokenMgr) |
| Reinitialise.
|
|
virtual QueryParserTokenPtr | getNextToken () |
| Get the next Token.
|
|
virtual QueryParserTokenPtr | getToken (int32_t index) |
| Get the specific Token.
|
|
virtual void | generateParseException () |
| Generate QueryParserError exception.
|
|
virtual void | enable_tracing () |
| Enable tracing.
|
|
virtual void | disable_tracing () |
| Disable tracing.
|
|
virtual | ~QueryParserConstants () |
|
virtual | ~LuceneObject () |
|
virtual void | initialize () |
| Called directly after instantiation to create objects that depend on this object being fully constructed.
|
|
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
| Return clone of this object.
|
|
virtual int32_t | hashCode () |
| Return hash code for this object.
|
|
virtual bool | equals (const LuceneObjectPtr &other) |
| Return whether two objects are equal.
|
|
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
| Compare two objects.
|
|
virtual String | toString () |
| Returns a string representation of the object.
|
|
virtual | ~LuceneSync () |
|
virtual SynchronizePtr | getSync () |
| Return this object synchronize lock.
|
|
virtual LuceneSignalPtr | getSignal () |
| Return this object signal.
|
|
virtual void | lock (int32_t timeout=0) |
| Lock this object using an optional timeout.
|
|
virtual void | unlock () |
| Unlock this object.
|
|
virtual bool | holdsLock () |
| Returns true if this object is currently locked by current thread.
|
|
virtual void | wait (int32_t timeout=0) |
| Wait for signal using an optional timeout.
|
|
virtual void | notifyAll () |
| Notify all threads waiting for signal.
|
|
|
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.
|
|
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.
|
|
void | applySlop (const 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.
|
|
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.
|
|
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)
|
|
virtual QueryPtr | getRangeQuery (const String &field, const String &part1, const String &part2, bool inclusive) |
| Builds a new TermRangeQuery instance for given min/max parts.
|
|
void | ConstructParser (const QueryParserCharStreamPtr &stream, const QueryParserTokenManagerPtr &tokenMgr) |
| Construct query parser with supplied QueryParserCharStream or TokenManager.
|
|
virtual void | addClause (Collection< BooleanClausePtr > clauses, int32_t conj, int32_t mods, const QueryPtr &q) |
|
BooleanQueryPtr | newBooleanQuery (bool disableCoord) |
| Builds a new BooleanQuery instance.
|
|
BooleanClausePtr | newBooleanClause (const QueryPtr &q, BooleanClause::Occur occur) |
| Builds a new BooleanClause instance.
|
|
QueryPtr | newTermQuery (const TermPtr &term) |
| Builds a new TermQuery instance.
|
|
PhraseQueryPtr | newPhraseQuery () |
| Builds a new PhraseQuery instance.
|
|
MultiPhraseQueryPtr | newMultiPhraseQuery () |
| Builds a new MultiPhraseQuery instance.
|
|
QueryPtr | newPrefixQuery (const TermPtr &prefix) |
| Builds a new PrefixQuery instance.
|
|
QueryPtr | newFuzzyQuery (const TermPtr &term, double minimumSimilarity, int32_t prefixLength) |
| Builds a new FuzzyQuery instance.
|
|
QueryPtr | newRangeQuery (const String &field, const String &part1, const String &part2, bool inclusive) |
| Builds a new TermRangeQuery instance.
|
|
QueryPtr | newMatchAllDocsQuery () |
| Builds a new MatchAllDocsQuery instance.
|
|
QueryPtr | newWildcardQuery (const TermPtr &term) |
| Builds a new WildcardQuery instance.
|
|
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.
|
|
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.
|
|
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.
|
|
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 () |
|
|
enum | Operator { OR_OPERATOR
, AND_OPERATOR
} |
| The default operator for parsing queries. Use QueryParser#setDefaultOperator to change it. More...
|
|
enum | RegularExpressionId {
_EOF = 0
, _NUM_CHAR = 1
, _ESCAPED_CHAR = 2
, _TERM_START_CHAR = 3
,
_TERM_CHAR = 4
, _WHITESPACE = 5
, _QUOTED_CHAR = 6
, AND = 8
,
OR = 9
, NOT = 10
, PLUS = 11
, MINUS = 12
,
LPAREN = 13
, RPAREN = 14
, COLON = 15
, STAR = 16
,
CARAT = 17
, QUOTED = 18
, TERM = 19
, FUZZY_SLOP = 20
,
PREFIXTERM = 21
, WILDTERM = 22
, RANGEIN_START = 23
, RANGEEX_START = 24
,
NUMBER = 25
, RANGEIN_TO = 26
, RANGEIN_END = 27
, RANGEIN_QUOTED = 28
,
RANGEIN_GOOP = 29
, RANGEEX_TO = 30
, RANGEEX_END = 31
, RANGEEX_QUOTED = 32
,
RANGEEX_GOOP = 33
} |
|
enum | LexicalState { Boost = 0
, RangeEx = 1
, RangeIn = 2
, DEFAULT = 3
} |
|
bool | lowercaseExpandedTerms |
|
RewriteMethodPtr | multiTermRewriteMethod |
|
bool | allowLeadingWildcard |
|
bool | enablePositionIncrements |
|
AnalyzerPtr | analyzer |
|
String | field |
|
int32_t | phraseSlop |
|
double | fuzzyMinSim |
|
int32_t | fuzzyPrefixLength |
|
std::locale | locale |
|
DateTools::Resolution | dateResolution |
|
MapStringResolution | fieldToDateResolution |
|
CollatorPtr | rangeCollator |
|
QueryParserTokenManagerPtr | token_source |
| Generated Token Manager.
|
|
QueryParserTokenPtr | token |
| Current token.
|
|
QueryParserTokenPtr | jj_nt |
| Next token.
|
|
static Collection< String > | tokenImage |
| Literal token values.
|
|
typedef boost::shared_ptr< JJCalls > | JJCallsPtr |
|
static int32_t | hexToInt (wchar_t c) |
| Returns the numeric value of the hexadecimal character.
|
|
static String | escape (const String &s) |
| Returns a String where those characters that QueryParser expects to be escaped are escaped by a preceding .
|
|
static const int32_t | CONJ_NONE |
|
static const int32_t | CONJ_AND |
|
static const int32_t | CONJ_OR |
|
static const int32_t | MOD_NONE |
|
static const int32_t | MOD_NOT |
|
static const int32_t | MOD_REQ |
|
static const int32_t | jj_la1_0 [] |
|
static const int32_t | jj_la1_1 [] |
|
static const wchar_t * | _tokenImage [] |
| Literal token values.
|
|
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.