The QueryParser type exposes the following members.

Methods

  NameDescription
Protected methodAddClause(ArrayList, Int32, Int32, Query) Obsolete.
Protected methodAddClause(IList, Int32, Int32, Query)
Public methodClause
Public methodConjunction
Public methodDisable_tracing
Disable tracing.
Public methodEnable_tracing
Enable tracing.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodStatic memberEscape
Returns a String where those characters that QueryParser expects to be escaped are escaped by a preceding
CopyC#
\
.
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGenerateParseException
Generate ParseException.
Public methodGetAllowLeadingWildcard
Public methodGetAnalyzer
Protected methodGetBooleanQuery(ArrayList) Obsolete.
Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in. Can be overridden by extending classes, to modify query being returned.
Protected methodGetBooleanQuery(IList)
Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in. Can be overridden by extending classes, to modify query being returned.
Protected methodGetBooleanQuery(ArrayList, Boolean) Obsolete.
Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in. Can be overridden by extending classes, to modify query being returned.
Protected methodGetBooleanQuery(IList, Boolean)
Factory method for generating query, given a set of clauses. By default creates a boolean query composed of clauses passed in. Can be overridden by extending classes, to modify query being returned.
Public methodGetDateResolution
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.
Public methodGetDefaultOperator
Gets implicit operator setting, which will be either AND_OPERATOR or OR_OPERATOR.
Public methodGetEnablePositionIncrements
Public methodGetField
Public methodGetFieldQuery(String, String)
Protected methodGetFieldQuery(String, String, Int32)
Base implementation delegates to {@link #GetFieldQuery(String,String)}. This method may be overridden, for example, to return a SpanNearQuery instead of a PhraseQuery.
Public methodGetFuzzyMinSim
Get the minimal similarity for fuzzy queries.
Public methodGetFuzzyPrefixLength
Get the prefix length for fuzzy queries.
Public methodGetFuzzyQuery
Factory method for generating a query (similar to {@link #getWildcardQuery}). Called when parser parses an input term token that has the fuzzy suffix (~) appended.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLocale
Returns current locale, allowing access by subclasses.
Public methodGetLowercaseExpandedTerms
Public methodGetMultiTermRewriteMethod
Public methodGetNextToken
Get the next Token.
Public methodGetPhraseSlop
Gets the default slop for phrases.
Public methodGetPrefixQuery
Factory method for generating a query (similar to {@link #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.

Public methodGetRangeCollator
Protected methodGetRangeQuery
Public methodGetToken
Get the specific Token.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUseOldRangeQuery Obsolete.
Public methodGetWildcardQuery
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)

Depending on settings, 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 wildcard queries, which may be necessary due to missing analyzer calls.

Public methodStatic memberMain
Command line tool to test QueryParser, using {@link Lucene.Net.Analysis.SimpleAnalyzer}. Usage:
CopyC#
java Lucene.Net.QueryParsers.QueryParser <input>
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodModifiers
Protected methodNewBooleanClause
Builds a new BooleanClause instance
Protected methodNewBooleanQuery
Builds a new BooleanQuery instance
Protected methodNewFuzzyQuery
Builds a new FuzzyQuery instance
Protected methodNewMatchAllDocsQuery
Builds a new MatchAllDocsQuery instance
Protected methodNewMultiPhraseQuery
Builds a new MultiPhraseQuery instance
Protected methodNewPhraseQuery
Builds a new PhraseQuery instance
Protected methodNewPrefixQuery
Builds a new PrefixQuery instance
Protected methodNewRangeQuery
Builds a new TermRangeQuery instance
Protected methodNewTermQuery
Builds a new TermQuery instance
Protected methodNewWildcardQuery
Builds a new WildcardQuery instance
Public methodParse
Parses a query string, returning a {@link Lucene.Net.Search.Query}.
Public methodQuery
Public methodReInit(CharStream)
Reinitialise.
Public methodReInit(QueryParserTokenManager)
Reinitialise.
Public methodSetAllowLeadingWildcard
Set to
CopyC#
true
to allow leading wildcard characters.

When set,

CopyC#
*
or
CopyC#
?
are allowed as the first character of a PrefixQuery and WildcardQuery. Note that this can produce very slow queries on big indexes.

Default: false.

Public methodSetDateResolution(DateTools..::..Resolution)
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 {@link #SetDateResolution(String, DateTools.Resolution)}.
Public methodSetDateResolution(String, DateTools..::..Resolution)
Sets the date resolution used by RangeQueries for a specific field.
Public methodSetDefaultOperator
Sets the boolean operator of the QueryParser. In default mode (
CopyC#
OR_OPERATOR
) terms without any modifiers are considered optional: for example
CopyC#
capital of Hungary
is equal to
CopyC#
capital OR of OR Hungary
.
In
CopyC#
AND_OPERATOR
mode terms are considered to be in conjunction: the above mentioned query is parsed as
CopyC#
capital AND of AND Hungary
Public methodSetEnablePositionIncrements
Set to
CopyC#
true
to enable position increments in result query.

When set, result phrase and multi-phrase queries will be aware of position increments. Useful when e.g. a StopFilter increases the position increment of the token that follows an omitted token.

Default: false.

Public methodSetFuzzyMinSim
Set the minimum similarity for fuzzy queries. Default is 0.5f.
Public methodSetFuzzyPrefixLength
Set the prefix length for fuzzy queries. Default is 0.
Public methodSetLocale
Set locale used by date range parsing.
Public methodSetLowercaseExpandedTerms
Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is
CopyC#
true
.
Public methodSetMultiTermRewriteMethod
By default QueryParser uses {@link 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 "TooManyBooleanClauses" 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.
Public methodSetPhraseSlop
Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.
Public methodSetRangeCollator
Sets the collator used to determine index term inclusion in ranges for RangeQuerys.

WARNING: Setting the rangeCollator to a non-null collator using this method will cause every single index Term in the Field referenced by lowerTerm and/or upperTerm to be examined. Depending on the number of index Terms in this Field, the operation could be very slow.

Public methodSetUseOldRangeQuery Obsolete.
Public methodTerm
Public methodTopLevelQuery
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

See Also