C# Class Lucene.Net.QueryParsers.ComplexPhrase.ComplexPhraseQueryParser

QueryParser which permits complex phrase query syntax eg "(john jon jonathan~) peters*".

Performs potentially multiple passes over Query text to parse any nested logic in PhraseQueries. - First pass takes any PhraseQuery content between quotes and stores for subsequent pass. All other query content is parsed as normal - Second pass parses any stored PhraseQuery content, checking all embedded clauses are referring to the same field and therefore can be rewritten as Span queries. All PhraseQuery clauses are expressed as ComplexPhraseQuery objects

This could arguably be done in one pass using a new QueryParser but here I am working within the constraints of the existing parser as a base class. This currently simply feeds all phrase content through an analyzer to select phrase terms - any "special" syntax such as * ~ * etc are not given special status

Inheritance: Classic.QueryParser
ファイルを表示 Open project: apache/lucenenet Class Usage Examples

Public Methods

Method Description
ComplexPhraseQueryParser ( LuceneVersion matchVersion, string f, Analyzer a ) : Lucene.Net.Analysis
Parse ( string query ) : Query

Protected Methods

Method Description
GetFieldQuery ( string field, string queryText, int slop ) : Query
GetFuzzyQuery ( string field, string termStr, float minSimilarity ) : Query
GetRangeQuery ( string field, string part1, string part2, bool startInclusive, bool endInclusive ) : Query
GetWildcardQuery ( string field, string termStr ) : Query
NewRangeQuery ( string field, string part1, string part2, bool startInclusive, bool endInclusive ) : Query
NewTermQuery ( Lucene.Net.Index.Term term ) : Query

Private Methods

Method Description
CheckPhraseClauseIsForSameField ( string field ) : void

Method Details

ComplexPhraseQueryParser() public method

public ComplexPhraseQueryParser ( LuceneVersion matchVersion, string f, Analyzer a ) : Lucene.Net.Analysis
matchVersion LuceneVersion
f string
a Lucene.Net.Analysis.Analyzer
return Lucene.Net.Analysis

GetFieldQuery() protected method

protected GetFieldQuery ( string field, string queryText, int slop ) : Query
field string
queryText string
slop int
return Lucene.Net.Search.Query

GetFuzzyQuery() protected method

protected GetFuzzyQuery ( string field, string termStr, float minSimilarity ) : Query
field string
termStr string
minSimilarity float
return Lucene.Net.Search.Query

GetRangeQuery() protected method

protected GetRangeQuery ( string field, string part1, string part2, bool startInclusive, bool endInclusive ) : Query
field string
part1 string
part2 string
startInclusive bool
endInclusive bool
return Lucene.Net.Search.Query

GetWildcardQuery() protected method

protected GetWildcardQuery ( string field, string termStr ) : Query
field string
termStr string
return Lucene.Net.Search.Query

NewRangeQuery() protected method

protected NewRangeQuery ( string field, string part1, string part2, bool startInclusive, bool endInclusive ) : Query
field string
part1 string
part2 string
startInclusive bool
endInclusive bool
return Lucene.Net.Search.Query

NewTermQuery() protected method

protected NewTermQuery ( Lucene.Net.Index.Term term ) : Query
term Lucene.Net.Index.Term
return Lucene.Net.Search.Query

Parse() public method

public Parse ( string query ) : Query
query string
return Lucene.Net.Search.Query