JsonFileCommitter
Local files of JSON format.
Notes
File Format
The generated file content will contain any number of "upsert" and "delete" objects. Both objects will contain the document "reference" and "metadata". The metadata is made of names followed by an undefined number of values as an array. The "upsert" entries also have a "content" property. Like this example containing 1 "upsert" and 1 "delete":
[
{"upsert": {
"reference": "https://example.com/my-document.html",
"metadata": {
"title": ["My Example Document"],
"keywords": [
"Example",
"Demo"
],
},
"content": "Document content goes here."
}},
{"delete": {
"reference": "https://example.com/i-was-deleted.html",
"metadata": {
"contentType": ["text/html"],
}
}},
]
Examples
- YAML
- JSON
- XML
class: JsonFileCommitter
filePath: /path/to/committer.json
{
"class": "JsonFileCommitter",
"filePath": "/path/to/committer.json"
}
<class>JsonFileCommitter</class>
<filePath>/path/to/committer.json</filePath>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: JsonFileCommitter
acl:
flatPrefix: string
format: NATIVE
partial: REJECT
compress: false
directory: string
docsPerFile: 0
fieldMappings: {}
fileNamePrefix: string
fileNameSuffix: string
indent: 0
restrictions:
- fieldMatcher: {}
valueMatcher: {}
splitUpsertDelete: false
{
"class": "JsonFileCommitter",
"acl": {
"flatPrefix": "string",
"format": "NATIVE",
"partial": "REJECT"
},
"compress": false,
"directory": "string",
"docsPerFile": 0,
"fieldMappings": {},
"fileNamePrefix": "string",
"fileNameSuffix": "string",
"indent": 0,
"restrictions": [
{
"fieldMatcher": {},
"valueMatcher": {}
}
],
"splitUpsertDelete": false
}
<jsonFileCommitter>
<class>JsonFileCommitter</class>
<acl>
<flatPrefix>string</flatPrefix>
<format>NATIVE</format>
<partial>REJECT</partial>
</acl>
<compress>false</compress>
<directory>string</directory>
<docsPerFile>0</docsPerFile>
<fieldMappings/>
<fileNamePrefix>string</fileNamePrefix>
<fileNameSuffix>string</fileNameSuffix>
<indent>0</indent>
<restrictions>
<restriction>
<fieldMatcher/>
<valueMatcher/>
</restriction>
</restrictions>
<splitUpsertDelete>false</splitUpsertDelete>
</jsonFileCommitter>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
acl | AclCommitterConfig | No | AclCommitterConfig |
compress | boolean | No | false |
directory | string | No | - |
docsPerFile | integer | No | 0 |
fieldMappings | Record<string, string> | No | - |
fileNamePrefix | string | No | - |
fileNameSuffix | string | No | - |
indent | integer | No | -1 |
restrictions | PropertyMatcher[] | No | - |
splitUpsertDelete | boolean | No | false |
Property Details
acl
How this committer sends the access control list (ACL) a document carries in its crawler.acl field, written by the
fetchers that read a source's permissions:
format:JSONsends the field as it is;FLATreplaces it with plain fields (below);NATIVEwrites it as the destination's own access control, for committers whose destination has one;NONEdoes not send it. When not set, the committer's default applies (NATIVEwhere available, otherwiseJSON).partial: what to do with a document whose permissions could only be read in part:REJECT(the default) orSEND.flatPrefix: the prefix of theFLATfields. Default isacl.
A document whose permissions cannot be vouched for is withheld: it is not sent, a version sent before is removed
from the destination, and the crawler tries it again on its next run. That is the case when its ACL is partial and
partial is REJECT, when its permissions could not be read at all, when the ACL is unreadable or of an unknown
version, or when NATIVE cannot express it. A withheld document is never sent as readable by everyone.
With FLAT, acl.levels names the checks a person must pass, in order, and each level has an allow field and a deny
field holding principals as kind:dir:id (or special:id):
acl.levels = share, file
acl.share.allow = group:ad:CORP:Sales
acl.file.allow = group:ad:CORP:Sales
acl.file.deny = group:ad:CORP:Interns
acl.owners = user:ad:CORP:pascal
A person may see the document if they match an allow value of every level and no deny value of any.
compress
Compress the generated JSON files using the GZIP file format.
directory
Local path where JSON files will be written.
docsPerFile
Maximum number of documents per JSON files.
fieldMappings
Mapping of source fields to target JSON properties.
fileNamePrefix
A string prepended to generated file names to distinguish them from other output files.
fileNameSuffix
A string appended to generated file names (before the extension) to distinguish them from other output files.
indent
Number of indentation spaces. Default does not indent.
restrictions
Defines filter conditions that restrict which documents this committer processes. Documents not matching the restrictions are ignored by this committer.
splitUpsertDelete
When enabled, a single update operation is split into separate upsert and delete operations for compatibility with the target system.