Class FilterExecutor
java.lang.Object
ai.nervemind.app.executor.FilterExecutor
- All Implemented Interfaces:
NodeExecutor
Executor for the "filter" node type - filters arrays based on conditions.
Processes an array of items and returns only those that match specified
conditions. Uses the same condition evaluation logic as SwitchExecutor
for consistency across conditional operations.
Node Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| inputField | String | "items" | Field containing array to filter |
| outputField | String | "filtered" | Field to store filtered results |
| conditions | List | [] | List of condition objects |
| combineWith | String | "and" | "and" or "or" - how to combine conditions |
| keepMatching | Boolean | true | true to keep matching items, false to keep non-matching |
Condition Structure
Same as SwitchExecutor - each condition has field, operator, and
value.
Example Configuration
{
"inputField": "products",
"outputField": "activeProducts",
"conditions": [
{ "field": "status", "operator": "equals", "value": "active" },
{ "field": "price", "operator": "greaterThan", "value": 0 }
],
"combineWith": "and"
}
Output Data
| Key | Type | Description |
|---|---|---|
| [outputField] | List | Array of items that matched conditions |
| _filteredCount | Integer | Number of items in result |
| _originalCount | Integer | Number of items before filtering |
| _removedCount | Integer | Number of items removed by filtering |
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Executes the business logic for this node type.Unique identifier for the node type this executor handles.
-
Constructor Details
-
FilterExecutor
public FilterExecutor()Default constructor.
-
-
Method Details
-
execute
public Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Description copied from interface:NodeExecutorExecutes the business logic for this node type.- Specified by:
executein interfaceNodeExecutor- Parameters:
node- The node definition containing parameters and configuration. UseNode.parameters()to access user settings.input- Combined output from all upstream nodes that connected to this node. For simple flows, this contains the direct predecessor's output. For merge nodes, it contains combined data.context- Verification context providing access to workflow-scoped services, logger, and execution metadata.- Returns:
- A Map containing the results of this node's execution.
Keys in this map become available variables for downstream nodes.
Note: Returningnullis treated as an empty map.
-
getNodeType
Description copied from interface:NodeExecutorUnique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.- Specified by:
getNodeTypein interfaceNodeExecutor- Returns:
- The unique type string (e.g., "httpRequest", "llmChat").
-