public class AnalyzingQueryParser extends QueryParser
*
)
don't get removed from the search terms.
Warning: This class should only be used with analyzers that do not use stopwords
or that add tokens. Also, several stemming analyzers are inappropriate: for example, GermanAnalyzer
will turn Häuser
into hau
, but H?user
will
become h?user
when using this parser and thus no match would be found (i.e.
using this parser will be no improvement over QueryParser in such cases).
QueryParser.Operator
AND_OPERATOR, jj_nt, OR_OPERATOR, token, token_source
_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, BAREOPER, Boost, CARAT, COLON, DEFAULT, EOF, FUZZY_SLOP, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, RangeEx, RANGEEX_END, RANGEEX_GOOP, RANGEEX_QUOTED, RANGEEX_START, RANGEEX_TO, RangeIn, RANGEIN_END, RANGEIN_GOOP, RANGEIN_QUOTED, RANGEIN_START, RANGEIN_TO, RPAREN, STAR, TERM, tokenImage, WILDTERM
Constructor and Description |
---|
AnalyzingQueryParser(Version matchVersion,
String field,
Analyzer analyzer)
Constructs a query parser.
|
Modifier and Type | Method and Description |
---|---|
protected Query |
getFuzzyQuery(String field,
String termStr,
float minSimilarity)
Called when parser parses an input term token that has the fuzzy suffix (~) appended.
|
protected Query |
getPrefixQuery(String field,
String termStr)
Called when parser parses an input term
token that uses prefix notation; that is, contains a single '*' wildcard
character as its last character.
|
protected Query |
getRangeQuery(String field,
String part1,
String part2,
boolean inclusive)
Overrides super class, by passing terms through analyzer.
|
protected Query |
getWildcardQuery(String field,
String termStr)
Called when parser
parses an input term token that contains one or more wildcard
characters (like
* ), but is not a prefix term token (one
that has just a single * character at the end). |
addClause, Clause, Conjunction, disable_tracing, enable_tracing, escape, generateParseException, getAllowLeadingWildcard, getAnalyzer, getAutoGeneratePhraseQueries, getBooleanQuery, getBooleanQuery, getDateResolution, getDefaultOperator, getEnablePositionIncrements, getField, getFieldQuery, getFieldQuery, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getLocale, getLowercaseExpandedTerms, getMultiTermRewriteMethod, getNextToken, getPhraseSlop, getRangeCollator, getToken, main, Modifiers, newBooleanClause, newBooleanQuery, newFuzzyQuery, newMatchAllDocsQuery, newMultiPhraseQuery, newPhraseQuery, newPrefixQuery, newRangeQuery, newTermQuery, newWildcardQuery, parse, Query, ReInit, ReInit, setAllowLeadingWildcard, setAutoGeneratePhraseQueries, setDateResolution, setDateResolution, setDefaultOperator, setEnablePositionIncrements, setFuzzyMinSim, setFuzzyPrefixLength, setLocale, setLowercaseExpandedTerms, setMultiTermRewriteMethod, setPhraseSlop, setRangeCollator, Term, TopLevelQuery
protected Query getWildcardQuery(String field, String termStr) throws ParseException
*
), but is not a prefix term token (one
that has just a single * character at the end).
Example: will be called for H?user
or for H*user
but not for *user
.
Depending on analyzer and settings, a wildcard term may (most probably will) be lower-cased automatically. It will go through the default Analyzer.
Overrides super class, by passing terms through analyzer.
getWildcardQuery
in class QueryParser
field
- Name of the field query will use.termStr
- Term token that contains one or more wild card
characters (? or *), but is not simple prefix termQuery
built for the termParseException
protected Query getPrefixQuery(String field, String termStr) throws ParseException
Depending on analyzer and settings, a prefix term may (most probably will) be lower-cased automatically. It will go through the default Analyzer.
Overrides super class, by passing terms through analyzer.
getPrefixQuery
in class QueryParser
field
- Name of the field query will use.termStr
- Term token to use for building term for the query
(without trailing '*' character!)Query
built for the termParseException
protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException
Depending on analyzer and settings, a fuzzy term may (most probably will) be lower-cased automatically. It will go through the default Analyzer.
Overrides super class, by passing terms through analyzer.
getFuzzyQuery
in class QueryParser
field
- Name of the field query will use.termStr
- Term token to use for building term for the queryQuery
built for the termParseException
protected Query getRangeQuery(String field, String part1, String part2, boolean inclusive) throws ParseException
getRangeQuery
in class QueryParser
ParseException