Class QueryNodeProcessor
This is a default implementation for the IQueryNodeProcessor interface, it's an abstract class, so it should be extended by classes that want to process a IQueryNode tree.
This class process IQueryNodes from left to right in the tree. While it's walking down the tree, for every node, PreProcessNode(IQueryNode) is invoked. After a node's children are processed, PostProcessNode(IQueryNode) is invoked for that node. SetChildrenOrder(IList<IQueryNode>) is invoked before PostProcessNode(IQueryNode) only if the node has at least one child, in SetChildrenOrder(IList<IQueryNode>) the implementor might redefine the children order or remove any children from the children list.
Here is an example about how it process the nodes:
a / \ b e / \ c d
Here is the order the methods would be invoked for the tree described above:
PreProcessNode( a );
PreProcessNode( b );
PreProcessNode( c );
PostProcessNode( c );
PreProcessNode( d );
PostProcessNode( d );
SetChildrenOrder( bChildrenList );
PostProcessNode( b );
PreProcessNode( e );
PostProcessNode( e );
SetChildrenOrder( aChildrenList );
PostProcessNode( a )
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.QueryParsers.Flexible.Core.Processors
Assembly: Lucene.Net.QueryParser.dll
Syntax
public abstract class QueryNodeProcessor : IQueryNodeProcessor
Constructors
QueryNodeProcessor()
This is a default implementation for the IQueryNodeProcessor interface, it's an abstract class, so it should be extended by classes that want to process a IQueryNode tree.
This class process IQueryNodes from left to right in the tree. While it's walking down the tree, for every node, PreProcessNode(IQueryNode) is invoked. After a node's children are processed, PostProcessNode(IQueryNode) is invoked for that node. SetChildrenOrder(IList<IQueryNode>) is invoked before PostProcessNode(IQueryNode) only if the node has at least one child, in SetChildrenOrder(IList<IQueryNode>) the implementor might redefine the children order or remove any children from the children list.
Here is an example about how it process the nodes:
a / \ b e / \ c d
Here is the order the methods would be invoked for the tree described above:
PreProcessNode( a );
PreProcessNode( b );
PreProcessNode( c );
PostProcessNode( c );
PreProcessNode( d );
PostProcessNode( d );
SetChildrenOrder( bChildrenList );
PostProcessNode( b );
PreProcessNode( e );
PostProcessNode( e );
SetChildrenOrder( aChildrenList );
PostProcessNode( a )
Declaration
protected QueryNodeProcessor()
See Also
QueryNodeProcessor(QueryConfigHandler)
This is a default implementation for the IQueryNodeProcessor interface, it's an abstract class, so it should be extended by classes that want to process a IQueryNode tree.
This class process IQueryNodes from left to right in the tree. While it's walking down the tree, for every node, PreProcessNode(IQueryNode) is invoked. After a node's children are processed, PostProcessNode(IQueryNode) is invoked for that node. SetChildrenOrder(IList<IQueryNode>) is invoked before PostProcessNode(IQueryNode) only if the node has at least one child, in SetChildrenOrder(IList<IQueryNode>) the implementor might redefine the children order or remove any children from the children list.
Here is an example about how it process the nodes:
a / \ b e / \ c d
Here is the order the methods would be invoked for the tree described above:
PreProcessNode( a );
PreProcessNode( b );
PreProcessNode( c );
PostProcessNode( c );
PreProcessNode( d );
PostProcessNode( d );
SetChildrenOrder( bChildrenList );
PostProcessNode( b );
PreProcessNode( e );
PostProcessNode( e );
SetChildrenOrder( aChildrenList );
PostProcessNode( a )
Declaration
protected QueryNodeProcessor(QueryConfigHandler queryConfigHandler)
Parameters
Type | Name | Description |
---|---|---|
QueryConfigHandler | queryConfigHandler |
See Also
Methods
GetQueryConfigHandler()
For reference about this method check: GetQueryConfigHandler().
Declaration
public virtual QueryConfigHandler GetQueryConfigHandler()
Returns
Type | Description |
---|---|
QueryConfigHandler | QueryConfigHandler the query configuration handler to be set. |
See Also
PostProcessNode(IQueryNode)
This method is invoked for every node when walking up the tree.
Declaration
protected abstract IQueryNode PostProcessNode(IQueryNode node)
Parameters
Type | Name | Description |
---|---|---|
IQueryNode | node | node the query node to be post-processed |
Returns
Type | Description |
---|---|
IQueryNode | a query node |
Exceptions
Type | Condition |
---|---|
QueryNodeException | if something goes wrong during the query node processing |
See Also
PreProcessNode(IQueryNode)
This method is invoked for every node when walking down the tree.
Declaration
protected abstract IQueryNode PreProcessNode(IQueryNode node)
Parameters
Type | Name | Description |
---|---|---|
IQueryNode | node | the query node to be pre-processed |
Returns
Type | Description |
---|---|
IQueryNode | a query node |
Exceptions
Type | Condition |
---|---|
QueryNodeException | if something goes wrong during the query node processing |
See Also
Process(IQueryNode)
Processes a query node tree. It may return the same or another query tree.
I should never return null
.
Declaration
public virtual IQueryNode Process(IQueryNode queryTree)
Parameters
Type | Name | Description |
---|---|---|
IQueryNode | queryTree | tree root node |
Returns
Type | Description |
---|---|
IQueryNode | the processed query tree |
See Also
ProcessChildren(IQueryNode)
This method is called every time a child is processed.
Declaration
protected virtual void ProcessChildren(IQueryNode queryTree)
Parameters
Type | Name | Description |
---|---|---|
IQueryNode | queryTree | the query node child to be processed |
Exceptions
Type | Condition |
---|---|
QueryNodeException | if something goes wrong during the query node processing |
See Also
SetChildrenOrder(IList<IQueryNode>)
This method is invoked for every node that has at least on child. It's invoked right before PostProcessNode(IQueryNode) is invoked.
Declaration
protected abstract IList<IQueryNode> SetChildrenOrder(IList<IQueryNode> children)
Parameters
Type | Name | Description |
---|---|---|
IList<IQueryNode> | children | the list containing all current node's children |
Returns
Type | Description |
---|---|
IList<IQueryNode> | a new list containing all children that should be set to the current node |
Exceptions
Type | Condition |
---|---|
QueryNodeException | if something goes wrong during the query node processing |
See Also
SetQueryConfigHandler(QueryConfigHandler)
For reference about this method check: SetQueryConfigHandler(QueryConfigHandler).
Declaration
public virtual void SetQueryConfigHandler(QueryConfigHandler queryConfigHandler)
Parameters
Type | Name | Description |
---|---|---|
QueryConfigHandler | queryConfigHandler | the query configuration handler to be set. |