Class StandardSyntaxParser
- java.lang.Object
-
- org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser
-
- All Implemented Interfaces:
SyntaxParser
,StandardSyntaxParserConstants
public class StandardSyntaxParser extends Object implements SyntaxParser, StandardSyntaxParserConstants
Parser for the standard Lucene syntax
-
-
Field Summary
Fields Modifier and Type Field Description Token
jj_nt
Next token.Token
token
Current token.StandardSyntaxParserTokenManager
token_source
Generated Token Manager.-
Fields inherited from interface org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParserConstants
_ESCAPED_CHAR, _NUM_CHAR, _QUOTED_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, Boost, CARAT, DEFAULT, EOF, FUZZY_SLOP, LPAREN, MINUS, NOT, NUMBER, OP_COLON, OP_EQUAL, OP_LESSTHAN, OP_LESSTHANEQ, OP_MORETHAN, OP_MORETHANEQ, OR, PLUS, QUOTED, Range, RANGE_GOOP, RANGE_QUOTED, RANGE_TO, RANGEEX_END, RANGEEX_START, RANGEIN_END, RANGEIN_START, REGEXPTERM, RPAREN, TERM, tokenImage
-
-
Constructor Summary
Constructors Constructor Description StandardSyntaxParser()
StandardSyntaxParser(CharStream stream)
Constructor with user supplied CharStream.StandardSyntaxParser(StandardSyntaxParserTokenManager tm)
Constructor with generated Token Manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryNode
Clause(CharSequence field)
QueryNode
ConjQuery(CharSequence field)
int
Conjunction()
void
disable_tracing()
Disable tracing.QueryNode
DisjQuery(CharSequence field)
void
enable_tracing()
Enable tracing.ParseException
generateParseException()
Generate ParseException.Token
getNextToken()
Get the next Token.Token
getToken(int index)
Get the specific Token.QueryNode
ModClause(CharSequence field)
ModifierQueryNode.Modifier
Modifiers()
QueryNode
parse(CharSequence query, CharSequence field)
Parses a query string, returning aQueryNode
.QueryNode
Query(CharSequence field)
void
ReInit(CharStream stream)
Reinitialise.void
ReInit(StandardSyntaxParserTokenManager tm)
Reinitialise.QueryNode
Term(CharSequence field)
QueryNode
TopLevelQuery(CharSequence field)
-
-
-
Field Detail
-
token_source
public StandardSyntaxParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
StandardSyntaxParser
public StandardSyntaxParser()
-
StandardSyntaxParser
public StandardSyntaxParser(CharStream stream)
Constructor with user supplied CharStream.
-
StandardSyntaxParser
public StandardSyntaxParser(StandardSyntaxParserTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
parse
public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException
Parses a query string, returning aQueryNode
.- Specified by:
parse
in interfaceSyntaxParser
- Parameters:
query
- the query string to be parsed.field
- - default field name- Returns:
- QueryNode tree
- Throws:
ParseException
- if the parsing failsQueryNodeParseException
-
Conjunction
public final int Conjunction() throws ParseException
- Throws:
ParseException
-
Modifiers
public final ModifierQueryNode.Modifier Modifiers() throws ParseException
- Throws:
ParseException
-
TopLevelQuery
public final QueryNode TopLevelQuery(CharSequence field) throws ParseException
- Throws:
ParseException
-
Query
public final QueryNode Query(CharSequence field) throws ParseException
- Throws:
ParseException
-
DisjQuery
public final QueryNode DisjQuery(CharSequence field) throws ParseException
- Throws:
ParseException
-
ConjQuery
public final QueryNode ConjQuery(CharSequence field) throws ParseException
- Throws:
ParseException
-
ModClause
public final QueryNode ModClause(CharSequence field) throws ParseException
- Throws:
ParseException
-
Clause
public final QueryNode Clause(CharSequence field) throws ParseException
- Throws:
ParseException
-
Term
public final QueryNode Term(CharSequence field) throws ParseException
- Throws:
ParseException
-
ReInit
public void ReInit(CharStream stream)
Reinitialise.
-
ReInit
public void ReInit(StandardSyntaxParserTokenManager 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.
-
-