|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.lucene.queryParser.QueryParser
This class is generated by JavaCC. The only method that clients should need to call is parse(). The syntax for query strings is as follows: A Query is a series of clauses. A clause may be prefixed by:
+
) or a minus (-
) sign, indicating
that the clause is required or prohibited respectively; or
+
/-
prefix to require any of a set of
terms.
Query ::= ( Clause )* Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )
Examples of appropriately formatted queries can be found in the test cases.
Field Summary | |
Token |
jj_nt
|
boolean |
lookingAhead
|
Token |
token
|
QueryParserTokenManager |
token_source
|
Fields inherited from interface org.apache.lucene.queryParser.QueryParserConstants |
_ESCAPED_CHAR, _NUM_CHAR, _TERM_CHAR, _TERM_START_CHAR, _WHITESPACE, AND, Boost, CARAT, COLON, DEFAULT, EOF, FUZZY, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, PREFIXTERM, QUOTED, RANGEEX, RANGEIN, RPAREN, SLOP, TERM, tokenImage, WILDTERM |
Constructor Summary | |
QueryParser(CharStream stream)
|
|
QueryParser(QueryParserTokenManager tm)
|
|
QueryParser(String f,
Analyzer a)
Constructs a query parser. |
Method Summary | |
Query |
Clause(String field)
|
int |
Conjunction()
|
void |
disable_tracing()
|
void |
enable_tracing()
|
ParseException |
generateParseException()
|
Token |
getNextToken()
|
int |
getPhraseSlop()
Gets the default slop for phrases. |
Token |
getToken(int index)
|
static void |
main(String[] args)
|
int |
Modifiers()
|
Query |
parse(String query)
Parses a query string, returning a Query. |
static Query |
parse(String query,
String field,
Analyzer analyzer)
Parses a query string, returning a Query . |
Query |
Query(String field)
|
void |
ReInit(CharStream stream)
|
void |
ReInit(QueryParserTokenManager tm)
|
void |
setPhraseSlop(int s)
Sets the default slop for phrases. |
Query |
Term(String field)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public QueryParserTokenManager token_source
public Token token
public Token jj_nt
public boolean lookingAhead
Constructor Detail |
public QueryParser(String f, Analyzer a)
public QueryParser(CharStream stream)
public QueryParser(QueryParserTokenManager tm)
Method Detail |
public static Query parse(String query, String field, Analyzer analyzer) throws ParseException
Query
.
query
- the query string to be parsed.field
- the default field for query terms.analyzer
- used to find terms in the query text.
ParseException
- if the parsing failspublic Query parse(String query) throws ParseException, TokenMgrError
query
- the query string to be parsed.
ParseException
- if the parsing fails
TokenMgrError
- if ther parsing failspublic void setPhraseSlop(int s)
public int getPhraseSlop()
public static void main(String[] args) throws Exception
Exception
public final int Conjunction() throws ParseException
ParseException
public final int Modifiers() throws ParseException
ParseException
public final Query Query(String field) throws ParseException
ParseException
public final Query Clause(String field) throws ParseException
ParseException
public final Query Term(String field) throws ParseException
ParseException
public void ReInit(CharStream stream)
public void ReInit(QueryParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public final ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |