Splits a sequence of documents into groups based on a specified function or metadata key
that returns or contains a sequence of group keys.
- Namespace
- Statiq
.Core - Interfaces
- Base Types
-
- object
- Module
graph BT
Type-->Base0["Module"]
click Base0 "/api/Statiq.Common/Module"
Base0-->Base1["object"]
Type-.->Interface0["IModule"]
click Interface0 "/api/Statiq.Common/IModule"
Type["GroupDocuments"]
class Type type-node
Syntax
public class GroupDocuments : Module, IModule
Remarks
This module forms groups from the input documents.
If the function or metadata key returns or contains an enumerable, each item in the enumerable
will become one of the grouping keys. If a document contains multiple group keys, it will
be included in multiple groups. A good example is a tag engine where each document can contain
any number of tags and you want to make groups for each tag including all the documents with that tag.
This module outputs a new document with the documents and key for each group.
Constructors
Name | Summary |
---|---|
GroupDocuments |
Partitions the input documents into groups with matching keys based on the key delegate. |
GroupDocuments |
Partitions the result of the input documents into groups with matching keys based on the value(s) at the specified metadata key. If a document to group does not contain the specified metadata key, it is not included in any output groups. |
Methods
Name | Return Value | Summary |
---|---|---|
AfterExecution |
void |
Called after each module execution.
Inherited from Module
|
AfterExecutionAsync |
Task |
Called after each module execution.
Inherited from Module
|
BeforeExecution |
void |
Called before each module execution.
Inherited from Module
|
BeforeExecutionAsync |
Task |
Called before each module execution.
Inherited from Module
|
ExecuteAsync |
Task |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
|
ExecuteContextAsync |
Task |
Executes the module once for all input documents.
|
ExecuteInputAsync |
Task |
Executes the module.
Inherited from Module
|
Finally |
void |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
FinallyAsync |
Task |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
WithComparer |
GroupDocuments |
Specifies an equality comparer to use for the grouping.
|
WithComparer |
GroupDocuments |
Specifies a typed equality comparer to use for the grouping. A conversion to the
comparer type will be attempted for all metadata values. If the conversion fails,
the value will not be considered equal. Note that this will also have the effect
of treating different convertible types as being of the same type. For example,
if you have two group keys, 1 and "1" (in that order), and use a string-based comparison, you will
only end up with a single group for those documents with a group key of 1 (since the
int key came first).
|
WithSource |
GroupDocuments |
Sets the source (and destination) of the output document(s).
|