Class QueryBuilder
Creates queries from the Analyzer chain.
Example usage:
QueryBuilder builder = new QueryBuilder(analyzer);
Query a = builder.CreateBooleanQuery("body", "just a test");
Query b = builder.CreatePhraseQuery("body", "another test");
Query c = builder.CreateMinShouldMatchQuery("body", "another test", 0.5f);
This can also be used as a subclass for query parsers to make it easier to interact with the analysis chain. Factory methods such as NewTermQuery(Term) are provided so that the generated queries can be customized.
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public class QueryBuilder : object
Constructors
Name | Description |
---|---|
QueryBuilder(Analyzer) | Creates a new QueryBuilder using the given analyzer. |
Properties
Name | Description |
---|---|
Analyzer | Gets or Sets the analyzer. |
EnablePositionIncrements | Gets or Sets whether position increments are enabled.
When Default: true. |
Methods
Name | Description |
---|---|
CreateBooleanQuery(String, String) | Creates a boolean query from the query text.
This is equivalent to |
CreateBooleanQuery(String, String, Occur) | Creates a boolean query from the query text. |
CreateFieldQuery(Analyzer, Occur, String, String, Boolean, Int32) | Creates a query from the analysis chain. Expert: this is more useful for subclasses such as queryparsers. If using this class directly, just use CreateBooleanQuery(String, String) and CreatePhraseQuery(String, String). |
CreateMinShouldMatchQuery(String, String, Single) | Creates a minimum-should-match query from the query text. |
CreatePhraseQuery(String, String) | Creates a phrase query from the query text.
This is equivalent to |
CreatePhraseQuery(String, String, Int32) | Creates a phrase query from the query text. |
NewBooleanQuery(Boolean) | Builds a new BooleanQuery instance. This is intended for subclasses that wish to customize the generated queries. |
NewMultiPhraseQuery() | Builds a new MultiPhraseQuery instance. This is intended for subclasses that wish to customize the generated queries. |
NewPhraseQuery() | Builds a new PhraseQuery instance. This is intended for subclasses that wish to customize the generated queries. |
NewTermQuery(Term) | Builds a new TermQuery instance. This is intended for subclasses that wish to customize the generated queries. |