com.lucene.queryParser
Class QueryParser

java.lang.Object
  |
  +--com.lucene.queryParser.QueryParser
All Implemented Interfaces:
QueryParserConstants

public class QueryParser
extends Object
implements QueryParserConstants

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:

A clause may be either a: Thus, in BNF, the query grammar is:
   Query  ::= ( Clause )*
   Clause ::= ["+", "-"] [ ":"] (  | "(" Query ")" )
 


Field Summary
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 QueryParserTokenManager token_source
           
 
Fields inherited from interface com.lucene.queryParser.QueryParserConstants
_ALPHA_CHAR, _ALPHANUM_CHAR, _IDENTIFIER, _IDENTIFIER_CHAR, _NEWLINE, _NUM_CHAR, _QCHAR, _RESTOFLINE, _WHITESPACE, AND, CARAT, COLON, DEFAULT, EOF, LPAREN, MINUS, NOT, NUMBER, OR, PLUS, QUOTED, RPAREN, STAR, TERM, tokenImage
 
Constructor Summary
QueryParser(InputStream stream)
           
QueryParser(QueryParserTokenManager tm)
           
QueryParser(Reader stream)
           
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(InputStream stream)
           
 void ReInit(QueryParserTokenManager tm)
           
 void ReInit(Reader stream)
           
 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

token_source

public QueryParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

QueryParser

public QueryParser(String f,
                   Analyzer a)
Constructs a query parser.
Parameters:
field - the default field for query terms.
analyzer - used to find terms in the query text.

QueryParser

public QueryParser(InputStream stream)

QueryParser

public QueryParser(Reader stream)

QueryParser

public QueryParser(QueryParserTokenManager tm)
Method Detail

parse

public static Query parse(String query,
                          String field,
                          Analyzer analyzer)
                   throws ParseException
Parses a query string, returning a Query.
Parameters:
query - the query string to be parsed.
field - the default field for query terms.
analyzer - used to find terms in the query text.

parse

public Query parse(String query)
            throws ParseException
Parses a query string, returning a Query.
Parameters:
query - the query string to be parsed.

setPhraseSlop

public void setPhraseSlop(int s)
Sets the default slop for phrases. If zero, then exact phrase matches are required. Zero by default.

getPhraseSlop

public int getPhraseSlop()
Gets the default slop for phrases.

main

public static void main(String[] args)
                 throws Exception

Conjunction

public final int Conjunction()
                      throws ParseException

Modifiers

public final int Modifiers()
                    throws ParseException

Query

public final Query Query(String field)
                  throws ParseException

Clause

public final Query Clause(String field)
                   throws ParseException

Term

public final Query Term(String field)
                 throws ParseException

ReInit

public void ReInit(InputStream stream)

ReInit

public void ReInit(Reader stream)

ReInit

public void ReInit(QueryParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public final ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()