Table of Contents

Class CustomMultiFieldQueryParser

Namespace
Examine.Lucene.Search
Assembly
Examine.Lucene.dll

We use this to get at the protected methods directly since the new version makes them not public

public class CustomMultiFieldQueryParser : MultiFieldQueryParser, ICommonQueryParserConfiguration
Inheritance
QueryBuilder
QueryParserBase
QueryParser
MultiFieldQueryParser
CustomMultiFieldQueryParser
Implements
ICommonQueryParserConfiguration
Derived
Inherited Members
MultiFieldQueryParser.m_fields
MultiFieldQueryParser.m_boosts
QueryParser.Conjunction()
QueryParser.Modifiers()
QueryParser.ReInit(ICharStream)
QueryParser.ReInit(QueryParserTokenManager)
QueryParser.GetNextToken()
QueryParser.GenerateParseException()
QueryParser.Enable_tracing()
QueryParser.Disable_tracing()
QueryParser.TokenSource
QueryParser.Token
QueryParser.Jj_nt
QueryParserBase.CONJ_NONE
QueryParserBase.CONJ_AND
QueryParserBase.CONJ_OR
QueryParserBase.MOD_NONE
QueryParserBase.MOD_NOT
QueryParserBase.MOD_REQ
QueryParserBase.AND_OPERATOR
QueryParserBase.OR_OPERATOR
QueryParserBase.m_field
QueryParserBase.SetDateResolution(DateResolution)
QueryParserBase.NewBooleanClause(Query, Occur)
QueryParserBase.NewPrefixQuery(Term)
QueryParserBase.NewRegexpQuery(Term)
QueryParserBase.NewMatchAllDocsQuery()
QueryParserBase.NewWildcardQuery(Term)
QueryParserBase.Field
QueryParserBase.AutoGeneratePhraseQueries
QueryParserBase.FuzzyMinSim
QueryParserBase.FuzzyPrefixLength
QueryParserBase.PhraseSlop
QueryParserBase.AllowLeadingWildcard
QueryParserBase.DefaultOperator
QueryParserBase.LowercaseExpandedTerms
QueryParserBase.MultiTermRewriteMethod
QueryParserBase.Locale
QueryParserBase.TimeZone
QueryParserBase.AnalyzeRangeTerms
QueryBuilder.NewTermQuery(Term)
QueryBuilder.NewPhraseQuery()
QueryBuilder.NewMultiPhraseQuery()
QueryBuilder.Analyzer
QueryBuilder.EnablePositionIncrements

Constructors

CustomMultiFieldQueryParser(LuceneVersion, string[], Analyzer)

public CustomMultiFieldQueryParser(LuceneVersion matchVersion, string[] fields, Analyzer analyzer)

Parameters

matchVersion LuceneVersion
fields string[]
analyzer Analyzer

Properties

SearchableFields

Fields that are searchable by the query parser

public string[] SearchableFields { get; }

Property Value

string[]

Methods

GetFieldQueryInternal(string, string)

Gets a query field

public Query GetFieldQueryInternal(string field, string queryText)

Parameters

field string
queryText string

Returns

Query

Exceptions

ArgumentException

GetFuzzyQueryInternal(string, string, float)

Gets a fuzzy query

public virtual Query GetFuzzyQueryInternal(string field, string termStr, float minSimilarity)

Parameters

field string
termStr string
minSimilarity float

Returns

Query

Exceptions

ArgumentException

GetProximityQueryInternal(string, string, int)

Gets a proximity query

public virtual Query GetProximityQueryInternal(string field, string queryText, int slop)

Parameters

field string
queryText string
slop int

Returns

Query

GetRangeQuery(string, string, string, bool, bool)

Override to provide support for numerical range query parsing

protected override Query GetRangeQuery(string field, string part1, string part2, bool startInclusive, bool endInclusive)

Parameters

field string
part1 string
part2 string
startInclusive bool
endInclusive bool

Returns

Query

Remarks

By Default the lucene query parser only deals with strings and the result is a TermRangeQuery, however for numerics it needs to be a NumericRangeQuery. We can override this method to provide that behavior.

In previous releases people were complaining that this wouldn't work and this is why. The answer came from here https://stackoverflow.com/questions/5026185/how-do-i-make-the-queryparser-in-lucene-handle-numeric-ranges

TODO: We could go further and override the field query and check if it is a numeric field, if so then we can automatically generate a numeric range query for the single digit too.

GetWildcardQueryInternal(string, string)

Gets a wildcard query

public virtual Query GetWildcardQueryInternal(string field, string termStr)

Parameters

field string
termStr string

Returns

Query

Exceptions

ArgumentException