Interface CommonQueryParserConfiguration
-
- All Known Implementing Classes:
AnalyzingQueryParser,ComplexPhraseQueryParser,ExtendableQueryParser,MultiFieldQueryParser,PrecedenceQueryParser,QueryParser,QueryParserBase,StandardQueryParser
public interface CommonQueryParserConfigurationConfiguration options common across queryparser implementations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleangetAllowLeadingWildcard()AnalyzergetAnalyzer()booleangetEnablePositionIncrements()floatgetFuzzyMinSim()Get the minimal similarity for fuzzy queries.intgetFuzzyPrefixLength()Get the prefix length for fuzzy queries.java.util.LocalegetLocale()Returns current locale, allowing access by subclasses.booleangetLowercaseExpandedTerms()MultiTermQuery.RewriteMethodgetMultiTermRewriteMethod()intgetPhraseSlop()Gets the default slop for phrases.java.util.TimeZonegetTimeZone()voidsetAllowLeadingWildcard(boolean allowLeadingWildcard)Set totrueto allow leading wildcard characters.voidsetDateResolution(DateTools.Resolution dateResolution)Sets the defaultDateTools.Resolutionused for certain field when noDateTools.Resolutionis defined for this field.voidsetEnablePositionIncrements(boolean enabled)Set totrueto enable position increments in result query.voidsetFuzzyMinSim(float fuzzyMinSim)Set the minimum similarity for fuzzy queries.voidsetFuzzyPrefixLength(int fuzzyPrefixLength)Set the prefix length for fuzzy queries.voidsetLocale(java.util.Locale locale)Set locale used by date range parsing.voidsetLowercaseExpandedTerms(boolean lowercaseExpandedTerms)Whether terms of multi-term queries (e.g., wildcard, prefix, fuzzy and range) should be automatically lower-cased or not.voidsetMultiTermRewriteMethod(MultiTermQuery.RewriteMethod method)By default, it usesMultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULTwhen creating a prefix, wildcard and range queries.voidsetPhraseSlop(int defaultPhraseSlop)Sets the default slop for phrases.voidsetTimeZone(java.util.TimeZone timeZone)
-
-
-
Method Detail
-
setLowercaseExpandedTerms
void setLowercaseExpandedTerms(boolean lowercaseExpandedTerms)
Whether terms of multi-term queries (e.g., wildcard, prefix, fuzzy and range) should be automatically lower-cased or not. Default istrue.
-
getLowercaseExpandedTerms
boolean getLowercaseExpandedTerms()
- See Also:
setLowercaseExpandedTerms(boolean)
-
setAllowLeadingWildcard
void setAllowLeadingWildcard(boolean allowLeadingWildcard)
Set totrueto allow leading wildcard characters.When set,
*or?are allowed as the first character of a PrefixQuery and WildcardQuery. Note that this can produce very slow queries on big indexes.Default: false.
-
setEnablePositionIncrements
void setEnablePositionIncrements(boolean enabled)
Set totrueto 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.
-
getEnablePositionIncrements
boolean getEnablePositionIncrements()
- See Also:
setEnablePositionIncrements(boolean)
-
setMultiTermRewriteMethod
void setMultiTermRewriteMethod(MultiTermQuery.RewriteMethod method)
By default, it usesMultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULTwhen creating a prefix, wildcard and range queries. This implementation is generally preferable because it a) Runs faster b) Does not have the scarcity of terms unduly influence score c) avoids anyTooManyListenersExceptionexception. However, if your application really needs to use the old-fashioned boolean queries expansion rewriting and the above points are not relevant then use this change the rewrite method.
-
getMultiTermRewriteMethod
MultiTermQuery.RewriteMethod getMultiTermRewriteMethod()
-
setFuzzyPrefixLength
void setFuzzyPrefixLength(int fuzzyPrefixLength)
Set the prefix length for fuzzy queries. Default is 0.- Parameters:
fuzzyPrefixLength- The fuzzyPrefixLength to set.
-
setLocale
void setLocale(java.util.Locale locale)
Set locale used by date range parsing.
-
getLocale
java.util.Locale getLocale()
Returns current locale, allowing access by subclasses.
-
setTimeZone
void setTimeZone(java.util.TimeZone timeZone)
-
getTimeZone
java.util.TimeZone getTimeZone()
-
setPhraseSlop
void setPhraseSlop(int defaultPhraseSlop)
Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero.
-
getAnalyzer
Analyzer getAnalyzer()
-
getAllowLeadingWildcard
boolean getAllowLeadingWildcard()
- See Also:
setAllowLeadingWildcard(boolean)
-
getFuzzyMinSim
float getFuzzyMinSim()
Get the minimal similarity for fuzzy queries.
-
getFuzzyPrefixLength
int getFuzzyPrefixLength()
Get the prefix length for fuzzy queries.- Returns:
- Returns the fuzzyPrefixLength.
-
getPhraseSlop
int getPhraseSlop()
Gets the default slop for phrases.
-
setFuzzyMinSim
void setFuzzyMinSim(float fuzzyMinSim)
Set the minimum similarity for fuzzy queries. Default is defined onFuzzyQuery.defaultMinSimilarity.
-
setDateResolution
void setDateResolution(DateTools.Resolution dateResolution)
Sets the defaultDateTools.Resolutionused for certain field when noDateTools.Resolutionis defined for this field.- Parameters:
dateResolution- the defaultDateTools.Resolution
-
-