Class QueryTreeBuilder<TQuery>
This class should be used when there is a builder for each type of node.
The type of node may be defined in 2 different ways: - by the field name, when the node implements the IFieldableNode interface - by its class, it keeps checking the class and all the interfaces and classes this class implements/extends until it finds a builder for that class/interface
This class always check if there is a builder for the field name before it checks for the node class. So, field name builders have precedence over class builders.
When a builder is found for a node, it's called and the node is passed to the
builder. If the returned built object is not null
, it's tagged
on the node using the tag QUERY_TREE_BUILDER_TAGID.
The children are usually built before the parent node. However, if a builder associated to a node is an instance of QueryTreeBuilder<TQuery>, the node is delegated to this builder and it's responsible to build the node and its children.
IQueryBuilder<TQuery>Implements
Inherited Members
Namespace: Lucene.Net.QueryParsers.Flexible.Core.Builders
Assembly: Lucene.Net.QueryParser.dll
Syntax
public class QueryTreeBuilder<TQuery> : QueryTreeBuilder, IQueryBuilder<TQuery>
Type Parameters
Name | Description |
---|---|
TQuery |
Constructors
QueryTreeBuilder()
QueryTreeBuilder<TQuery> constructor.
Declaration
public QueryTreeBuilder()
Methods
Build(IQueryNode)
Builds some kind of object from a query tree. Each node in the query tree is built using an specific builder associated to it.
Declaration
public virtual TQuery Build(IQueryNode queryNode)
Parameters
Type | Name | Description |
---|---|---|
IQueryNode | queryNode | the query tree root node |
Returns
Type | Description |
---|---|
TQuery | the built object |
Exceptions
Type | Condition |
---|---|
QueryNodeException | if some node builder throws a QueryNodeException or if there is a node which had no builder associated to it |
SetBuilder(string, IQueryBuilder<TQuery>)
Associates a field name with a builder.
Declaration
public virtual void SetBuilder(string fieldName, IQueryBuilder<TQuery> builder)
Parameters
Type | Name | Description |
---|---|---|
string | fieldName | the field name |
IQueryBuilder<TQuery> | builder | the builder to be associated |
SetBuilder(Type, IQueryBuilder<TQuery>)
Associates a class (that implements IQueryNode) with a builder
Declaration
public virtual void SetBuilder(Type queryNodeClass, IQueryBuilder<TQuery> builder)
Parameters
Type | Name | Description |
---|---|---|
Type | queryNodeClass | The type (a class that implements IQueryNode) |
IQueryBuilder<TQuery> | builder | the builder to be associated |