Class QueryParserHelper<TQuery>
This class is a helper for the query parser framework, it does all the three query parser phrases at once: text parsing, query processing and query building.
It contains methods that allows the user to change the implementation used on the three phases.
Inherited Members
Namespace: Lucene.Net.QueryParsers.Flexible.Core
Assembly: Lucene.Net.QueryParser.dll
Syntax
public class QueryParserHelper<TQuery>
Type Parameters
Name | Description |
---|---|
TQuery |
Constructors
QueryParserHelper(QueryConfigHandler, ISyntaxParser, IQueryNodeProcessor, IQueryBuilder<TQuery>)
Creates a query parser helper object using the specified configuration, text parser, processor and builder.
Declaration
public QueryParserHelper(QueryConfigHandler queryConfigHandler, ISyntaxParser syntaxParser, IQueryNodeProcessor processor, IQueryBuilder<TQuery> builder)
Parameters
Type | Name | Description |
---|---|---|
QueryConfigHandler | queryConfigHandler | the query configuration handler that will be initially set to this helper |
ISyntaxParser | syntaxParser | the text parser that will be initially set to this helper |
IQueryNodeProcessor | processor | the query processor that will be initially set to this helper |
IQueryBuilder<TQuery> | builder | the query builder that will be initially set to this helper |
See Also
Properties
QueryBuilder
Returns the query builder used to build a object from the query node tree. The object produced by this builder is returned by Parse(string, string).
Declaration
public virtual IQueryBuilder<TQuery> QueryBuilder { get; }
Property Value
Type | Description |
---|---|
IQueryBuilder<TQuery> |
See Also
QueryConfigHandler
Returns the query configuration handler, which is used during the query
node tree processing. It can be null
.
Declaration
public virtual QueryConfigHandler QueryConfigHandler { get; }
Property Value
Type | Description |
---|---|
QueryConfigHandler |
See Also
QueryNodeProcessor
Gets the processor object used to process the query node tree, it
returns null
if no processor is used.
Declaration
public virtual IQueryNodeProcessor QueryNodeProcessor { get; }
Property Value
Type | Description |
---|---|
IQueryNodeProcessor |
See Also
SyntaxParser
Returns the text parser used to build a query node tree from a query string. The default text parser instance returned by this method is a ISyntaxParser.
Declaration
public virtual ISyntaxParser SyntaxParser { get; }
Property Value
Type | Description |
---|---|
ISyntaxParser |
See Also
Methods
Parse(string, string)
Parses a query string to an object, usually some query object.
In this method the three phases are executed:- the query string is parsed using the text parser returned by SyntaxParser, the result is a query node tree.
- the query node tree is processed by the processor returned by QueryNodeProcessor.
- a object is built from the query node tree using the builder returned by QueryBuilder.
Declaration
public virtual TQuery Parse(string query, string defaultField)
Parameters
Type | Name | Description |
---|---|---|
string | query | the query string |
string | defaultField | the default field used by the text parser |
Returns
Type | Description |
---|---|
TQuery | the object built from the query |
Exceptions
Type | Condition |
---|---|
QueryNodeException | if something wrong happens along the three phases |
See Also
SetQueryBuilder(IQueryBuilder<TQuery>)
The query builder that will be used to build an object from the query node
tree. It cannot be null
.
Declaration
public virtual void SetQueryBuilder(IQueryBuilder<TQuery> queryBuilder)
Parameters
Type | Name | Description |
---|---|---|
IQueryBuilder<TQuery> | queryBuilder | the query builder used to build something from the query node tree |
See Also
SetQueryConfigHandler(QueryConfigHandler)
Sets the query configuration handler that will be used during query
processing. It can be null
. It's also set to the processor
returned by QueryNodeProcessor.
Declaration
public virtual void SetQueryConfigHandler(QueryConfigHandler config)
Parameters
Type | Name | Description |
---|---|---|
QueryConfigHandler | config | the query configuration handler used during query processing, it
can be |
See Also
SetQueryNodeProcessor(IQueryNodeProcessor)
Sets the processor that will be used to process the query node tree. If
there is any QueryConfigHandler returned by
QueryConfigHandler, it will be set on the processor. The
argument can be null
, which means that no processor will be
used to process the query node tree.
Declaration
public virtual void SetQueryNodeProcessor(IQueryNodeProcessor processor)
Parameters
Type | Name | Description |
---|---|---|
IQueryNodeProcessor | processor | the processor that will be used to process the query node tree,
this argument can be |
See Also
SetSyntaxParser(ISyntaxParser)
Sets the text parser that will be used to parse the query string, it cannot
be null
.
Declaration
public virtual void SetSyntaxParser(ISyntaxParser syntaxParser)
Parameters
Type | Name | Description |
---|---|---|
ISyntaxParser | syntaxParser | the text parser that will be used to parse the query string |