Usage
-
GroupBy(DocumentConfig key, IEnumerable<IModule> modules)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.
keyA delegate that returns the group key.
modulesModules to execute on the input documents prior to grouping.
-
GroupBy(DocumentConfig key, params IModule[] modules)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.
keyA delegate that returns the group key.
modulesModules to execute on the input documents prior to grouping.
-
GroupBy(string keyMetadataKey, IEnumerable<IModule> modules)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.
keyMetadataKeyThe key metadata key.
modulesModules to execute on the input documents prior to grouping.
-
GroupBy(string keyMetadataKey, params IModule[] modules)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.
keyMetadataKeyThe key metadata key.
modulesModules to execute on the input documents prior to grouping.
Fluent Methods
Chain these methods together after the constructor to modify behavior.
-
Where(DocumentConfig predicate)Limits the documents to be grouped to those that satisfy the supplied predicate.
predicateA delegate that should return a
bool.
-
WithComparer(IEqualityComparer<Object> comparer)Specifies an equality comparer to use for the grouping.
comparerThe equality comparer to use.
-
WithComparer<TValue>(IEqualityComparer<TValue> comparer)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
intkey came first).comparerThe typed equality comparer to use.
-
WithEmptyOutputIfNoGroups(bool emptyOutput = true)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.
emptyOutputtrueto not output documents when no groups are found.
Output Metadata
The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.
-
Keys.GroupDocuments:IEnumerable<IDocument>Contains all the documents for the current group.
-
Keys.GroupKey:System.ObjectThe key for the current group.
