Package org.apache.solr.parser
Class QueryParser
- java.lang.Object
-
- org.apache.lucene.util.QueryBuilder
-
- org.apache.solr.parser.SolrQueryParserBase
-
- org.apache.solr.parser.QueryParser
-
- All Implemented Interfaces:
QueryParserConstants
- Direct Known Subclasses:
SolrQueryParser
public class QueryParser extends SolrQueryParserBase implements QueryParserConstants
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryParser.Operator
The default operator for parsing queries.-
Nested classes/interfaces inherited from class org.apache.solr.parser.SolrQueryParserBase
SolrQueryParserBase.MagicFieldName, SolrQueryParserBase.RawQuery, SolrQueryParserBase.SynonymQueryStyle
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_SPLIT_ON_WHITESPACE
default split on whitespace behaviorToken
jj_nt
Next token.Token
token
Current token.QueryParserTokenManager
token_source
Generated Token Manager.-
Fields inherited from class org.apache.solr.parser.SolrQueryParserBase
AND_OPERATOR, explicitField, operator, OR_OPERATOR, parser, REVERSE_WILDCARD_LOWER_BOUND, schema, synonymQueryStyle, TERMS_QUERY_THRESHOLD
-
Fields inherited from class org.apache.lucene.util.QueryBuilder
analyzer, autoGenerateMultiTermSynonymsPhraseQuery, enableGraphQueries, enablePositionIncrements
-
Fields inherited from interface org.apache.solr.parser.QueryParserConstants
_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _SQUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, BAREOPER, Boost, CARAT, COLON, COMMENT, DEFAULT, EOF, FILTER, FUZZY_SLOP, LPARAMS, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, Range, RANGE_GOOP, RANGE_QUOTED, RANGE_TO, RANGEEX_END, RANGEEX_START, RANGEIN_END, RANGEIN_START, REGEXPTERM, RPAREN, STAR, TERM, tokenImage, WILDTERM
-
-
Constructor Summary
Constructors Modifier Constructor Description QueryParser(String defaultField, QParser parser)
protected
QueryParser(CharStream stream)
Constructor with user supplied CharStream.protected
QueryParser(QueryParserTokenManager tm)
Constructor with generated Token Manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.search.Query
Clause(String field)
int
Conjunction()
void
disable_tracing()
Disable tracing.void
enable_tracing()
Enable tracing.ParseException
generateParseException()
Generate ParseException.Token
getNextToken()
Get the next Token.boolean
getSplitOnWhitespace()
Token
getToken(int index)
Get the specific Token.int
Modifiers()
void
MultiTerm(String field, List<org.apache.lucene.search.BooleanClause> clauses)
protected org.apache.lucene.search.Query
newFieldQuery(org.apache.lucene.analysis.Analyzer analyzer, String field, String queryText, boolean quoted, boolean fieldAutoGenPhraseQueries, boolean fieldEnableGraphQueries, SolrQueryParserBase.SynonymQueryStyle synonymQueryStyle)
org.apache.lucene.search.Query
Query(String field)
void
ReInit(CharStream stream)
Reinitialise.void
ReInit(QueryParserTokenManager tm)
Reinitialise.void
setSplitOnWhitespace(boolean splitOnWhitespace)
Whether query text should be split on whitespace prior to analysis.org.apache.lucene.search.Query
Term(String field)
org.apache.lucene.search.Query
TopLevelQuery(String field)
-
Methods inherited from class org.apache.solr.parser.SolrQueryParserBase
addClause, addMultiTermClause, analyzeIfMultitermTermText, escape, getAllowLeadingWildcard, getAutoGeneratePhraseQueries, getBooleanQuery, getDefaultField, getDefaultOperator, getExistenceQuery, getExplicitField, getField, getFieldQuery, getFieldQuery, getFieldQuery, getFieldQuery, getFuzzyMinSim, getFuzzyPrefixLength, getFuzzyQuery, getLocalParams, getMultiTermRewriteMethod, getPhraseSlop, getPrefixQuery, getRangeQuery, getRangeQueryImpl, getRegexpQuery, getReversedWildcardFilterFactory, getSynonymQueryStyle, getWildcardQuery, init, isAllowSubQueryParsing, isRangeShouldBeProtectedFromReverse, newBooleanClause, newFuzzyQuery, newGraphSynonymQuery, newMatchAllDocsQuery, newPrefixQuery, newRegexpQuery, newSynonymQuery, newWildcardQuery, parse, setAllowLeadingWildcard, setAllowSubQueryParsing, setAutoGeneratePhraseQueries, setDefaultOperator, setFuzzyMinSim, setFuzzyPrefixLength, setMultiTermRewriteMethod, setPhraseSlop, setSynonymQueryStyle
-
Methods inherited from class org.apache.lucene.util.QueryBuilder
add, analyzeBoolean, analyzeGraphBoolean, analyzeGraphPhrase, analyzeMultiBoolean, analyzeMultiPhrase, analyzePhrase, analyzeTerm, createBooleanQuery, createBooleanQuery, createFieldQuery, createFieldQuery, createMinShouldMatchQuery, createPhraseQuery, createPhraseQuery, createSpanQuery, getAnalyzer, getAutoGenerateMultiTermSynonymsPhraseQuery, getEnableGraphQueries, getEnablePositionIncrements, newBooleanQuery, newMultiPhraseQueryBuilder, newTermQuery, setAnalyzer, setAutoGenerateMultiTermSynonymsPhraseQuery, setEnableGraphQueries, setEnablePositionIncrements
-
-
-
-
Field Detail
-
DEFAULT_SPLIT_ON_WHITESPACE
public static final boolean DEFAULT_SPLIT_ON_WHITESPACE
default split on whitespace behavior- See Also:
- Constant Field Values
-
token_source
public QueryParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
QueryParser
protected QueryParser(CharStream stream)
Constructor with user supplied CharStream.
-
QueryParser
protected QueryParser(QueryParserTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
getSplitOnWhitespace
public boolean getSplitOnWhitespace()
- See Also:
setSplitOnWhitespace(boolean)
-
setSplitOnWhitespace
public void setSplitOnWhitespace(boolean splitOnWhitespace)
Whether query text should be split on whitespace prior to analysis. Default isfalse
.
-
newFieldQuery
protected org.apache.lucene.search.Query newFieldQuery(org.apache.lucene.analysis.Analyzer analyzer, String field, String queryText, boolean quoted, boolean fieldAutoGenPhraseQueries, boolean fieldEnableGraphQueries, SolrQueryParserBase.SynonymQueryStyle synonymQueryStyle) throws SyntaxError
- Overrides:
newFieldQuery
in classSolrQueryParserBase
- Throws:
SyntaxError
-
Conjunction
public final int Conjunction() throws ParseException
- Throws:
ParseException
-
Modifiers
public final int Modifiers() throws ParseException
- Throws:
ParseException
-
TopLevelQuery
public final org.apache.lucene.search.Query TopLevelQuery(String field) throws ParseException, SyntaxError
- Specified by:
TopLevelQuery
in classSolrQueryParserBase
- Throws:
ParseException
SyntaxError
-
Query
public final org.apache.lucene.search.Query Query(String field) throws ParseException, SyntaxError
- Throws:
ParseException
SyntaxError
-
Clause
public final org.apache.lucene.search.Query Clause(String field) throws ParseException, SyntaxError
- Throws:
ParseException
SyntaxError
-
Term
public final org.apache.lucene.search.Query Term(String field) throws ParseException, SyntaxError
- Throws:
ParseException
SyntaxError
-
MultiTerm
public final void MultiTerm(String field, List<org.apache.lucene.search.BooleanClause> clauses) throws ParseException, SyntaxError
- Throws:
ParseException
SyntaxError
-
ReInit
public void ReInit(CharStream stream)
Reinitialise.- Specified by:
ReInit
in classSolrQueryParserBase
-
ReInit
public void ReInit(QueryParserTokenManager tm)
Reinitialise.
-
getNextToken
public final Token getNextToken()
Get the next Token.
-
getToken
public final Token getToken(int index)
Get the specific Token.
-
generateParseException
public ParseException generateParseException()
Generate ParseException.
-
enable_tracing
public final void enable_tracing()
Enable tracing.
-
disable_tracing
public final void disable_tracing()
Disable tracing.
-
-