|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.unimi.dsi.mg4j.query.parser.QueryParser
This class is used to parse queries. You are supposed to create a query parser by giving a map that maps index names
(called index aliases) to indices (instances of the Index class), and the name of the default index
alias to be used.
After that, you parse a query by using the parse(String) method.
| Field Summary | |
Token |
jj_nt
|
boolean |
lookingAhead
|
Token |
token
|
QueryParserTokenManager |
token_source
|
| Fields inherited from interface it.unimi.dsi.mg4j.query.parser.QueryParserConstants |
AND, CLOSE_PAREN, COLON, DEFAULT, EOF, NOT, OPEN_PAREN, OR, QUOTE, SHARP, TILDA, tokenImage, WORD |
| Constructor Summary | |
QueryParser(Index index)
Creates a query parser for a single index. |
|
QueryParser(InputStream stream)
|
|
QueryParser(Map indexMap,
String defaultIndex)
Creates a query parser. |
|
QueryParser(QueryParserTokenManager tm)
|
|
QueryParser(Reader stream)
|
|
| Method Summary | |
DocumentIterator |
andQuery(String indexAlias,
boolean dontChange)
Starting rule for an AND-query (the AND token is optional). |
DocumentIterator |
atomicQuery(String indexAlias,
boolean dontChange)
Starting rule for an atomic query. |
DocumentIterator |
atomicSimpleQuery(String indexAlias,
boolean dontChange)
Starting rule for an atomic simple query. |
void |
disable_tracing()
|
void |
enable_tracing()
|
ParseException |
generateParseException()
|
Token |
getNextToken()
|
Token |
getToken(int index)
|
DocumentIterator |
parse(String query)
Parses the given query, returning the corresponding query result. |
DocumentIterator |
query(String indexAlias,
boolean dontChange)
Starting rule for a OR-query. |
DocumentIterator |
quotedQuery(String indexAlias,
boolean dontChange)
Starting rule for a quoted query. |
void |
ReInit(InputStream stream)
|
void |
ReInit(QueryParserTokenManager tm)
|
void |
ReInit(Reader stream)
|
DocumentIterator |
start(String indexAlias,
boolean dontChange)
Starting rule for a query. |
| 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(Map indexMap,
String defaultIndex)
indexMap - a map from strings (index alias) to Index objects.defaultIndex - the default index alias to be used when parsing the query.public QueryParser(Index index)
Parsers created by this constructor allow only nameless access, both in the query and in the interval-iterator methods.
index - the only index for the queries.public QueryParser(InputStream stream)
public QueryParser(Reader stream)
public QueryParser(QueryParserTokenManager tm)
| Method Detail |
public DocumentIterator parse(String query)
throws ParseException,
TokenMgrError,
IOException
query - the query to be parsed.
ParseException - if a parse exception has taken place during query parsing.
TokenMgrError - if a tokenization exception has taken place during query parsing.
IOException - if a low-level I/O exception was thrown while trying to read some index.
public final DocumentIterator start(String indexAlias,
boolean dontChange)
throws ParseException
indexAlias - the index alias for the default index to be used for the query that is going to be parsed.dontChange - if true, the query cannot contain index selectors other than indexAlias.
ParseException
public final DocumentIterator query(String indexAlias,
boolean dontChange)
throws ParseException
indexAlias - the index alias for the default index to be used for the query that is going to be parsed.dontChange - if true, the query cannot contain index selectors other than indexAlias.
ParseException
public final DocumentIterator andQuery(String indexAlias,
boolean dontChange)
throws ParseException
indexAlias - the index alias for the default index to be used for the query that is going to be parsed.dontChange - if true, the query cannot contain index selectors other than indexAlias.
ParseException
public final DocumentIterator quotedQuery(String indexAlias,
boolean dontChange)
throws ParseException
indexAlias - the index alias for the default index to be used for the query that is going to be parsed.dontChange - if true, the query cannot contain index selectors other than indexAlias.
ParseException
public final DocumentIterator atomicQuery(String indexAlias,
boolean dontChange)
throws ParseException
indexAlias - the index alias for the default index to be used for the query that is going to be parsed.dontChange - if true, the query cannot contain index selectors other than indexAlias.
ParseException
public final DocumentIterator atomicSimpleQuery(String indexAlias,
boolean dontChange)
throws ParseException
indexAlias - the index alias for the default index to be used for the query that is going to be parsed.dontChange - if true, the query cannot contain index selectors other than indexAlias.
ParseExceptionpublic void ReInit(InputStream stream)
public void ReInit(Reader stream)
public void ReInit(QueryParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public 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 | |||||||||