Class CustomMultiFieldQueryParser
We use this to get at the protected methods directly since the new version makes them not public
public class CustomMultiFieldQueryParser : MultiFieldQueryParser, ICommonQueryParserConfiguration
- Inheritance
-
QueryBuilderQueryParserBaseQueryParserMultiFieldQueryParserCustomMultiFieldQueryParser
- Implements
-
ICommonQueryParserConfiguration
- Derived
- Inherited Members
-
MultiFieldQueryParser.m_fieldsMultiFieldQueryParser.m_boostsQueryParser.Conjunction()QueryParser.Modifiers()QueryParser.ReInit(ICharStream)QueryParser.ReInit(QueryParserTokenManager)QueryParser.GetNextToken()QueryParser.GenerateParseException()QueryParser.Enable_tracing()QueryParser.Disable_tracing()QueryParser.TokenSourceQueryParser.TokenQueryParser.Jj_ntQueryParserBase.CONJ_NONEQueryParserBase.CONJ_ANDQueryParserBase.CONJ_ORQueryParserBase.MOD_NONEQueryParserBase.MOD_NOTQueryParserBase.MOD_REQQueryParserBase.AND_OPERATORQueryParserBase.OR_OPERATORQueryParserBase.m_fieldQueryParserBase.SetDateResolution(DateResolution)QueryParserBase.NewBooleanClause(Query, Occur)QueryParserBase.NewPrefixQuery(Term)QueryParserBase.NewRegexpQuery(Term)QueryParserBase.NewMatchAllDocsQuery()QueryParserBase.NewWildcardQuery(Term)QueryParserBase.FieldQueryParserBase.AutoGeneratePhraseQueriesQueryParserBase.FuzzyMinSimQueryParserBase.FuzzyPrefixLengthQueryParserBase.PhraseSlopQueryParserBase.AllowLeadingWildcardQueryParserBase.DefaultOperatorQueryParserBase.LowercaseExpandedTermsQueryParserBase.MultiTermRewriteMethodQueryParserBase.LocaleQueryParserBase.TimeZoneQueryParserBase.AnalyzeRangeTermsQueryBuilder.NewTermQuery(Term)QueryBuilder.NewPhraseQuery()QueryBuilder.NewMultiPhraseQuery()QueryBuilder.AnalyzerQueryBuilder.EnablePositionIncrements
Constructors
CustomMultiFieldQueryParser(LuceneVersion, string[], Analyzer)
public CustomMultiFieldQueryParser(LuceneVersion matchVersion, string[] fields, Analyzer analyzer)
Parameters
matchVersion
LuceneVersionfields
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
Returns
- Query
Exceptions
GetFuzzyQueryInternal(string, string, float)
Gets a fuzzy query
public virtual Query GetFuzzyQueryInternal(string field, string termStr, float minSimilarity)
Parameters
Returns
- Query
Exceptions
GetProximityQueryInternal(string, string, int)
Gets a proximity query
public virtual Query GetProximityQueryInternal(string field, string queryText, int slop)
Parameters
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
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
Returns
- Query