@@ -4,7 +4,7 @@ title: Reprocessing Data
4
4
nav_order : 5
5
5
---
6
6
7
- Flux supports reprocessing data already in MarkLogic by using custom code to query for data and custom code to process
7
+ Flux supports reprocessing data in MarkLogic by using custom code to query for data and custom code to process
8
8
retrieved data. Reprocessing data typically involves writing data back to MarkLogic, but you are free to execute any
9
9
custom code you wish both when querying and processing data.
10
10
@@ -26,7 +26,40 @@ A common use case for reprocessing is for the reader to return document URIs, an
26
26
on each document URI. However, your reader is free to return any items, and your writer is free to perform any
27
27
processing you wish.
28
28
29
- For the reader, you must specify one of the following options:
29
+ Your reader code must return a sequence, whether implemented [ in JavaScript] ( https://docs.marklogic.com/js/Sequence )
30
+ or [ in XQuery] ( https://docs.marklogic.com/guide/xquery/langoverview#id_88685 ) . The following show simple examples
31
+ of both:
32
+
33
+ ```
34
+ // Return a sequence of URIs in JavaScript.
35
+ cts.uris("", null, cts.collectionQuery('example'))
36
+ ```
37
+
38
+ ```
39
+ (: Return a sequence of URIs in XQuery. :)
40
+ cts:uris((), (), cts:collection-query('example'))
41
+ ```
42
+
43
+ Your writer code will then be invoked once for each item returned by the reader (see below for instructions on sending
44
+ a batch of items to the writer). The writer code will be sent a variable named ` URI ` , though the items do not need to
45
+ be URIs. The following show simple examples of JavaScript and XQuery writers (document metadata such as collections
46
+ and permissions are omitted for the sake of brevity):
47
+
48
+ ```
49
+ // A simple JavaScript writer.
50
+ declareUpdate();
51
+ var URI;
52
+ xdmp.documentInsert(URI, {"example": "document"});
53
+ ```
54
+
55
+ ```
56
+ (: A simple XQuery writer :)
57
+ xquery version "1.0-ml";
58
+ declare variable $URI external;
59
+ xdmp:document-insert($URI, <example>document</example>)
60
+ ```
61
+
62
+ To configure the reader, you must specify one of the following options:
30
63
31
64
| Option | Description|
32
65
| --- | ---|
@@ -36,7 +69,7 @@ For the reader, you must specify one of the following options:
36
69
| ` --read-xquery-file ` | Path to file containing XQuery code for reading data. |
37
70
| ` --read-invoke ` | Path of a MarkLogic server module to invoke for reading data. |
38
71
39
- For the writer, you must specify one of the following options:
72
+ To configure the writer, you must specify one of the following options:
40
73
41
74
| Option | Description|
42
75
| --- | ---|
0 commit comments