public class HelloWorld extends Object
This sample uses the marklogic-hello-world.xml config file.
The config file name is hard-coded into the sample for simplicity, so no additional command line options are required by the sample.
The mapper creates key-value pairs where the key is always the same constant and the value is the first word from the document. The reducer sorts the words, concatenates them together, and writes them to an output document. Since all key-value pairs produced by the mapper have the same key, there's only one input pair to the reducer, producing a a single output document.
For example, given 2 input documents whose first words are "hello" and "world", the mapper produces: (1, "hello") and (1, "world"). The reducer receives (1, ("hello", "world")) as input and inserts HelloWorld.txt in the database, containing "hello world".
Modifier and Type | Class and Description |
---|---|
static class |
HelloWorld.MyMapper |
static class |
HelloWorld.MyReducer |
Constructor and Description |
---|
HelloWorld() |
> Copyright © 2018 MarkLogic Corporation. All Rights Reserved.
Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com