C# 클래스 Lucene.Net.QueryParsers.Classic.QueryParser

This class is generated by JavaCC. The most important method is QueryParserBase.Parse(string). The syntax for query strings is as follows: A Query is a series of clauses. A clause may be prefixed by: a plus (+) or a minus (-) sign, indicating that the clause is required or prohibited respectively; or a term followed by a colon, indicating the field to be searched. This enables one to construct queries which search multiple fields. A clause may be either: a term, indicating all the documents that contain this term; or a nested query, enclosed in parentheses. Note that this may be used with a +/- prefix to require any of a set of terms. Thus, in BNF, the query grammar is: Query ::= ( Clause )* Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )

Examples of appropriately formatted queries can be found in the query syntax documentation.

In TermRangeQuerys, QueryParser tries to detect date values, e.g. date:[6/1/2005 TO 6/4/2005] produces a range query that searches for "date" fields between 2005-06-01 and 2005-06-04. Note that the format of the accepted input depends on the Locale. A Documents.DateTools.Resolution has to be set, if you want to use Documents.DateTools for date conversion.

The date resolution that shall be used for RangeQueries can be set using QueryParserBase.SetDateResolution(Documents.DateTools.Resolution) or QueryParserBase.SetDateResolution(string, Documents.DateTools.Resolution). The former sets the default date resolution for all fields, whereas the latter can be used to set field specific date resolutions. Field specific date resolutions take, if set, precedence over the default date resolution.

If you don't use Documents.DateTools in your index, you can create your own query parser that inherits QueryParser and overwrites QueryParserBase.GetRangeQuery(string, string, string, bool, bool) to use a different method for date conversion.

Note that QueryParser is not thread-safe.

NOTE: there is a new QueryParser in contrib, which matches the same syntax as this class, but is more modular, enabling substantial customization to how a query is created.

NOTE: You must specify the required LuceneVersion compatibility when creating QueryParser: As of 3.1, QueryParserBase.AutoGeneratePhraseQueries is false by default.
상속: Lucene.Net.QueryParsers.Classic.QueryParserBase
파일 보기 프로젝트 열기: apache/lucenenet 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
jj_nt Token
token Token
token_source QueryParserTokenManager

공개 메소드들

메소드 설명
Clause ( string field ) : Query
Conjunction ( ) : int
Disable_tracing ( ) : void

Disable tracing.

Enable_tracing ( ) : void

Enable tracing.

GenerateParseException ( ) : ParseException

Generate ParseException.

GetNextToken ( ) : Token

Get the next Token.

GetToken ( int index ) : Token

Get the specific Token.

Modifiers ( ) : int
Query ( string field ) : Query
QueryParser ( LuceneVersion matchVersion, string f, Analyzer a ) : Lucene.Net.Analysis

Constructs a query parser.

ReInit ( ICharStream stream ) : void

Reinitialize.

ReInit ( QueryParserTokenManager tm ) : void

Reinitialize.

Term ( string field ) : Query
TopLevelQuery ( string field ) : Query

보호된 메소드들

메소드 설명
QueryParser ( ICharStream stream ) : Lucene.Net.Analysis

Constructor with user supplied ICharStream.

QueryParser ( QueryParserTokenManager tm ) : Lucene.Net.Analysis

Constructor with generated Token Manager.

비공개 메소드들

메소드 설명
Jj_2_1 ( int xla ) : bool
Jj_3R_2 ( ) : bool
Jj_3R_3 ( ) : bool
Jj_3_1 ( ) : bool
Jj_add_error_token ( int kind, int pos ) : void
Jj_consume_token ( int kind ) : Token
Jj_la1_init_0 ( ) : void
Jj_la1_init_1 ( ) : void
Jj_ntk ( ) : int
Jj_rescan_token ( ) : void
Jj_save ( int index, int xla ) : void
Jj_scan_token ( int kind ) : bool
QueryParser ( ) : Lucene.Net.Analysis

메소드 상세

Clause() 공개 메소드

public Clause ( string field ) : Query
field string
리턴 Lucene.Net.Search.Query

Conjunction() 공개 메소드

public Conjunction ( ) : int
리턴 int

Disable_tracing() 공개 메소드

Disable tracing.
public Disable_tracing ( ) : void
리턴 void

Enable_tracing() 공개 메소드

Enable tracing.
public Enable_tracing ( ) : void
리턴 void

GenerateParseException() 공개 메소드

Generate ParseException.
public GenerateParseException ( ) : ParseException
리턴 ParseException

GetNextToken() 공개 메소드

Get the next Token.
public GetNextToken ( ) : Token
리턴 Token

GetToken() 공개 메소드

Get the specific Token.
public GetToken ( int index ) : Token
index int
리턴 Token

Modifiers() 공개 메소드

public Modifiers ( ) : int
리턴 int

Query() 공개 메소드

public Query ( string field ) : Query
field string
리턴 Lucene.Net.Search.Query

QueryParser() 보호된 메소드

Constructor with user supplied ICharStream.
protected QueryParser ( ICharStream stream ) : Lucene.Net.Analysis
stream ICharStream
리턴 Lucene.Net.Analysis

QueryParser() 공개 메소드

Constructs a query parser.
public QueryParser ( LuceneVersion matchVersion, string f, Analyzer a ) : Lucene.Net.Analysis
matchVersion LuceneVersion Lucene version to match.
f string the default field for query terms.
a Lucene.Net.Analysis.Analyzer used to find terms in the query text.
리턴 Lucene.Net.Analysis

QueryParser() 보호된 메소드

Constructor with generated Token Manager.
protected QueryParser ( QueryParserTokenManager tm ) : Lucene.Net.Analysis
tm QueryParserTokenManager
리턴 Lucene.Net.Analysis

ReInit() 공개 메소드

Reinitialize.
public ReInit ( ICharStream stream ) : void
stream ICharStream
리턴 void

ReInit() 공개 메소드

Reinitialize.
public ReInit ( QueryParserTokenManager tm ) : void
tm QueryParserTokenManager
리턴 void

Term() 공개 메소드

public Term ( string field ) : Query
field string
리턴 Lucene.Net.Search.Query

TopLevelQuery() 공개 최종 메소드

public final TopLevelQuery ( string field ) : Query
field string
리턴 Lucene.Net.Search.Query

프로퍼티 상세

jj_nt 공개적으로 프로퍼티

Next token.
public Token jj_nt
리턴 Token

token 공개적으로 프로퍼티

Current token.
public Token token
리턴 Token

token_source 공개적으로 프로퍼티

Generated Token Manager.
public QueryParserTokenManager,Lucene.Net.QueryParsers.Classic token_source
리턴 QueryParserTokenManager