GroupByMany Class

Summary

Splits a sequence of documents into groups based on a specified function or metadata key that returns or contains a sequence of group keys.
Assembly
Wyam.Core.dll
Namespace
Wyam.Core.Modules.Control
Interfaces
Base Types
graph BT Type-->Base0["ContainerModule"] click Base0 "/api/Wyam.Common.Modules/ContainerModule" Base0-->Base1["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type-.->Interface1["IModuleList"] click Interface1 "/api/Wyam.Common.Modules/IModuleList" Type-.->Interface2["IList<IModule>"] Type["GroupByMany"] class Type type-node

Syntax

public class GroupByMany : ContainerModule, IModule, IModuleList, IList<IModule>

Remarks

This module forms groups from the output documents of the specified modules. 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. Each input document is cloned for each group and metadata related to the groups, including the sequence of documents for each group, is added to each clone. For example, if you have 2 input documents and the result of grouping is 3 groups, this module will output 6 documents.

Constructors

Name Summary
GroupByMany(DocumentConfig, IEnumerable<IModule>) Partitions the result of the specified modules into groups with matching keys based on the key delegate. The input documents to GroupBy are used as the initial input documents to the specified modules.
GroupByMany(DocumentConfig, IModule[]) Partitions the result of the specified modules into groups with matching keys based on the key delegate. The input documents to GroupBy are used as the initial input documents to the specified modules.
GroupByMany(string, IEnumerable<IModule>) Partitions the result of the specified modules into groups with matching keys based on the value 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. The input documents to GroupBy are used as the initial input documents to the specified modules.
GroupByMany(string, IModule[]) Partitions the result of the specified modules into groups with matching keys based on the value 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. The input documents to GroupBy are used as the initial input documents to the specified modules.

Properties

Name Value Summary
Count int
Inherited from ContainerModule
IsReadOnly bool
Inherited from ContainerModule
this[int] IModule
Inherited from ContainerModule
this[string] IModule
Gets the module with the specified name.
Inherited from ContainerModule

Methods

Name Value Summary
Add(IModule) void
Inherited from ContainerModule
Add(IModule[]) void
Adds modules to the list. Any null items in the sequence of modules will be discarded.
Inherited from ContainerModule
Add(string, IModule) void
Adds a module to the list with a specified name.
Inherited from ContainerModule
AsKeyValuePairs() IEnumerable<KeyValuePair<string, IModule>>
Returns the list as a sequence of key-value pairs with the keys being the module names and the values being the module instances.
Inherited from ContainerModule
Clear() void
Inherited from ContainerModule
Contains(IModule) bool
Inherited from ContainerModule
Contains(string) bool
Determines if the list contains a module with the specified name.
Inherited from ContainerModule
CopyTo(IModule[], int) void
Inherited from ContainerModule
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
GetEnumerator() IEnumerator<IModule>
Inherited from ContainerModule
IndexOf(IModule) int
Inherited from ContainerModule
IndexOf(string) int
Gets the index of the module with the specified name.
Inherited from ContainerModule
Insert(int, IModule) void
Inherited from ContainerModule
Insert(int, IModule[]) void
Inserts modules into the list. Any null items in the sequence of modules will be discarded.
Inherited from ContainerModule
Insert(int, string, IModule) void
Inserts a module into the list with a specified name.
Inherited from ContainerModule
Remove(IModule) bool
Inherited from ContainerModule
Remove(string) bool
Removes a module by name.
Inherited from ContainerModule
RemoveAt(int) void
Inherited from ContainerModule
TryGetValue(string, IModule) bool
Attempts to get a module with the specified name.
Inherited from ContainerModule
Where(DocumentConfig) GroupByMany
Limits the documents to be grouped to those that satisfy the supplied predicate.
WithComparer(IEqualityComparer<Object>) GroupByMany
Specifies an equality comparer to use for the grouping.
WithComparer<TValue>(IEqualityComparer<TValue>) GroupByMany
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).
WithEmptyOutputIfNoGroups(bool) GroupByMany
Specifies that no documents should be output if there are no groups. This is in contrast to the default behavior of outputting the unmodified input documents if no groups were found.
GitHub