The MultiFieldQueryParser type exposes the following members.

Constructors

  NameDescription
Public methodMultiFieldQueryParser(array<String>[]()[][], Analyzer) Obsolete.
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

CopyC#
title
and
CopyC#
body
):

CopyC#
(title:term1 body:term1) (title:term2 body:term2)

When setDefaultOperator(AND_OPERATOR) is set, the result will be:

CopyC#
+(title:term1 body:term1) +(title:term2 body:term2)

In other words, all the query's terms must appear, but it doesn't matter in what fields they appear.

Public methodMultiFieldQueryParser(array<String>[]()[][], Analyzer, IDictionary) Obsolete.
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

CopyC#
title
and
CopyC#
body
):

CopyC#
(title:term1 body:term1) (title:term2 body:term2)

When setDefaultOperator(AND_OPERATOR) is set, the result will be:

CopyC#
+(title:term1 body:term1) +(title:term2 body:term2)

When you pass a boost (title=>5 body=>10) you can get

CopyC#
+(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.

Public methodMultiFieldQueryParser(Version, array<String>[]()[][], 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

CopyC#
title
and
CopyC#
body
):

CopyC#
(title:term1 body:term1) (title:term2 body:term2)

When setDefaultOperator(AND_OPERATOR) is set, the result will be:

CopyC#
+(title:term1 body:term1) +(title:term2 body:term2)

In other words, all the query's terms must appear, but it doesn't matter in what fields they appear.

Public methodMultiFieldQueryParser(Version, array<String>[]()[][], Analyzer, IDictionary)
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

CopyC#
title
and
CopyC#
body
):

CopyC#
(title:term1 body:term1) (title:term2 body:term2)

When setDefaultOperator(AND_OPERATOR) is set, the result will be:

CopyC#
+(title:term1 body:term1) +(title:term2 body:term2)

When you pass a boost (title=>5 body=>10) you can get

CopyC#
+(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.

Methods

  NameDescription
Protected methodAddClause(ArrayList, Int32, Int32, Query) Obsolete. (Inherited from QueryParser.)
Protected methodAddClause(IList, Int32, Int32, Query) (Inherited from QueryParser.)
Public methodClause (Inherited from QueryParser.)
Public methodConjunction (Inherited from QueryParser.)
Public methodDisable_tracing
Disable tracing.
(Inherited from QueryParser.)
Public methodEnable_tracing
Enable tracing.
(Inherited from QueryParser.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
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.
(Inherited from QueryParser.)
Public methodGetAllowLeadingWildcard (Inherited from QueryParser.)
Public methodGetAnalyzer (Inherited from QueryParser.)
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.
(Inherited from QueryParser.)
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.
(Inherited from QueryParser.)
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.
(Inherited from QueryParser.)
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.
(Inherited from QueryParser.)
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.
(Inherited from QueryParser.)
Public methodGetDefaultOperator
Gets implicit operator setting, which will be either AND_OPERATOR or OR_OPERATOR.
(Inherited from QueryParser.)
Public methodGetEnablePositionIncrements (Inherited from QueryParser.)
Public methodGetField (Inherited from QueryParser.)
Public methodGetFieldQuery(String, String) (Overrides QueryParser..::..GetFieldQuery(String, String).)
Protected methodGetFieldQuery(String, String, Int32) (Overrides QueryParser..::..GetFieldQuery(String, String, Int32).)
Public methodGetFuzzyMinSim
Get the minimal similarity for fuzzy queries.
(Inherited from QueryParser.)
Public methodGetFuzzyPrefixLength
Get the prefix length for fuzzy queries.
(Inherited from QueryParser.)
Public methodGetFuzzyQuery (Overrides QueryParser..::..GetFuzzyQuery(String, String, Single).)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLocale
Returns current locale, allowing access by subclasses.
(Inherited from QueryParser.)
Public methodGetLowercaseExpandedTerms (Inherited from QueryParser.)
Public methodGetMultiTermRewriteMethod (Inherited from QueryParser.)
Public methodGetNextToken
Get the next Token.
(Inherited from QueryParser.)
Public methodGetPhraseSlop
Gets the default slop for phrases.
(Inherited from QueryParser.)
Public methodGetPrefixQuery (Overrides QueryParser..::..GetPrefixQuery(String, String).)
Public methodGetRangeCollator (Inherited from QueryParser.)
Protected methodGetRangeQuery (Overrides QueryParser..::..GetRangeQuery(String, String, String, Boolean).)
Public methodGetToken
Get the specific Token.
(Inherited from QueryParser.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUseOldRangeQuery Obsolete. (Inherited from QueryParser.)
Public methodGetWildcardQuery (Overrides QueryParser..::..GetWildcardQuery(String, String).)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodModifiers (Inherited from QueryParser.)
Protected methodNewBooleanClause
Builds a new BooleanClause instance
(Inherited from QueryParser.)
Protected methodNewBooleanQuery
Builds a new BooleanQuery instance
(Inherited from QueryParser.)
Protected methodNewFuzzyQuery
Builds a new FuzzyQuery instance
(Inherited from QueryParser.)
Protected methodNewMatchAllDocsQuery
Builds a new MatchAllDocsQuery instance
(Inherited from QueryParser.)
Protected methodNewMultiPhraseQuery
Builds a new MultiPhraseQuery instance
(Inherited from QueryParser.)
Protected methodNewPhraseQuery
Builds a new PhraseQuery instance
(Inherited from QueryParser.)
Protected methodNewPrefixQuery
Builds a new PrefixQuery instance
(Inherited from QueryParser.)
Protected methodNewRangeQuery
Builds a new TermRangeQuery instance
(Inherited from QueryParser.)
Protected methodNewTermQuery
Builds a new TermQuery instance
(Inherited from QueryParser.)
Protected methodNewWildcardQuery
Builds a new WildcardQuery instance
(Inherited from QueryParser.)
Public methodParse(String)
Parses a query string, returning a {@link Lucene.Net.Search.Query}.
(Inherited from QueryParser.)
Public methodStatic memberParse(array<String>[]()[][], array<String>[]()[][], Analyzer) Obsolete.
Parses a query which searches on the fields specified.

If x fields are specified, this effectively constructs:

            <code>
            (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)
            </code>
            
Public methodStatic memberParse(String, array<String>[]()[][], array<BooleanClause..::..Occur>[]()[][], Analyzer) Obsolete.
Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

            Usage:
            
CopyC#
String[] fields = {"filename", "contents", "description"};
BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT};
MultiFieldQueryParser.parse("query", fields, flags, analyzer);

The code above would construct a query:

CopyC#
(filename:query) +(contents:query) -(description:query)
Public methodStatic memberParse(array<String>[]()[][], array<String>[]()[][], array<BooleanClause..::..Occur>[]()[][], Analyzer) Obsolete.
Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

            Usage:
            
CopyC#
String[] query = {"query1", "query2", "query3"};
String[] fields = {"filename", "contents", "description"};
BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST_NOT};
MultiFieldQueryParser.parse(query, fields, flags, analyzer);

The code above would construct a query:

CopyC#
(filename:query1) +(contents:query2) -(description:query3)
Public methodStatic memberParse(Version, array<String>[]()[][], array<String>[]()[][], Analyzer)
Parses a query which searches on the fields specified.

If x fields are specified, this effectively constructs:

            <code>
            (field1:query1) (field2:query2) (field3:query3)...(fieldx:queryx)
            </code>
            
Public methodStatic memberParse(Version, String, array<String>[]()[][], array<BooleanClause..::..Occur>[]()[][], Analyzer)
Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

            Usage:
            <code>
            String[] fields = {"filename", "contents", "description"};
            BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
            BooleanClause.Occur.MUST,
            BooleanClause.Occur.MUST_NOT};
            MultiFieldQueryParser.parse("query", fields, flags, analyzer);
            </code>
            

The code above would construct a query:

            <code>
            (filename:query) +(contents:query) -(description:query)
            </code>
            
Public methodStatic memberParse(Version, array<String>[]()[][], array<String>[]()[][], array<BooleanClause..::..Occur>[]()[][], Analyzer)
Parses a query, searching on the fields specified. Use this if you need to specify certain fields as required, and others as prohibited.

            Usage:
            <code>
            String[] query = {"query1", "query2", "query3"};
            String[] fields = {"filename", "contents", "description"};
            BooleanClause.Occur[] flags = {BooleanClause.Occur.SHOULD,
            BooleanClause.Occur.MUST,
            BooleanClause.Occur.MUST_NOT};
            MultiFieldQueryParser.parse(query, fields, flags, analyzer);
            </code>
            

The code above would construct a query:

            <code>
            (filename:query1) +(contents:query2) -(description:query3)
            </code>
            
Public methodQuery (Inherited from QueryParser.)
Public methodReInit(CharStream)
Reinitialise.
(Inherited from QueryParser.)
Public methodReInit(QueryParserTokenManager)
Reinitialise.
(Inherited from QueryParser.)
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.

(Inherited from QueryParser.)
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)}.
(Inherited from QueryParser.)
Public methodSetDateResolution(String, DateTools..::..Resolution)
Sets the date resolution used by RangeQueries for a specific field.
(Inherited from QueryParser.)
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
(Inherited from QueryParser.)
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.

(Inherited from QueryParser.)
Public methodSetFuzzyMinSim
Set the minimum similarity for fuzzy queries. Default is 0.5f.
(Inherited from QueryParser.)
Public methodSetFuzzyPrefixLength
Set the prefix length for fuzzy queries. Default is 0.
(Inherited from QueryParser.)
Public methodSetLocale
Set locale used by date range parsing.
(Inherited from QueryParser.)
Public methodSetLowercaseExpandedTerms
Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. Default is
CopyC#
true
.
(Inherited from QueryParser.)
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.
(Inherited from QueryParser.)
Public methodSetPhraseSlop
Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.
(Inherited from QueryParser.)
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.

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

Fields

  NameDescription
Protected fieldboosts
Protected fieldfields
Public fieldtoken
Current token.
(Inherited from QueryParser.)
Public fieldtoken_source
Generated Token Manager.
(Inherited from QueryParser.)

See Also