Skip to main content

CsvFileCommitter

Local comma-separated values files.

Notes​

Commits crawled documents to local comma-separated values (CSV) files. Supports configurable delimiters, quoting, column mappings, multi-value joining, file compression, and output directory settings.

Examples​

class: CsvFileCommitter
filePath: /path/to/committer.csv

Usage​

Full configuration skeleton, with every option and its default
class: CsvFileCommitter
acl:
flatPrefix: string
format: NATIVE
partial: REJECT
columns:
- field: string
header: string
truncateAt: 0
compress: false
delimiter: string
directory: string
docsPerFile: 0
escape: string
fieldMappings: {}
fileNamePrefix: string
fileNameSuffix: string
format: DEFAULT
multiValueJoinDelimiter: string
quote: string
restrictions:
- fieldMatcher: {}
valueMatcher: {}
showHeaders: false
splitUpsertDelete: false
truncateAt: 0
typeHeader: string

Properties​

PropertyTypeRequiredDefault
aclAclCommitterConfigNoAclCommitterConfig
columnsCsvColumn[]No-
compressbooleanNofalse
delimiterstringNo-
directorystringNo-
docsPerFileintegerNo0
escapestringNo-
fieldMappingsRecord<string, string>No-
fileNamePrefixstringNo-
fileNameSuffixstringNo-
formatenumNo-
multiValueJoinDelimiterstringNo-
quotestringNo-
restrictionsPropertyMatcher[]No-
showHeadersbooleanNofalse
splitUpsertDeletebooleanNofalse
truncateAtintegerNo5096
typeHeaderstringNo-

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: JSON sends the field as it is; FLAT replaces it with plain fields (below); NATIVE writes it as the destination's own access control, for committers whose destination has one; NONE does not send it. When not set, the committer's default applies (NATIVE where available, otherwise JSON).
  • partial: what to do with a document whose permissions could only be read in part: REJECT (the default) or SEND.
  • flatPrefix: the prefix of the FLAT fields. Default is acl.

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.

columns​

Target columns for desired document field values.

compress​

Compress the generated CSV files using the GZIP file format.

delimiter​

Delimiter

directory​

Local path where CSV files will be written.

docsPerFile​

Maximum number of documents per CSV files.

escape​

The escape character to use when needed.

fieldMappings​

Mapping of source fields to target ones (CSV columns).

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.

format​

Configuration presets optimized for specific applications consuming CSV files.

Allowed Values​

  • DEFAULT
  • EXCEL
  • INFORMIX_UNLOAD1_3
  • INFORMIX_UNLOAD_CSV1_3
  • MONGO_CSV1_7
  • MONGO_TSV1_7
  • MYSQL
  • ORACLE1_6
  • POSTGRESSQL_CSV1_5
  • POSTGRESSQL_TEXT1_5
  • RFC_4180
  • TDF

multiValueJoinDelimiter​

One or more characters to be used as a delimiter when combining multi-value fields to become single-value.

quote​

A character used to quote values.

restrictions​

Defines filter conditions that restrict which documents this committer processes. Documents not matching the restrictions are ignored by this committer.

showHeaders​

Write column headers at the first of a generated document.

splitUpsertDelete​

When enabled, a single update operation is split into separate upsert and delete operations for compatibility with the target system.

truncateAt​

Truncate values larger than N characters. Default is 5096. Use -1 for unlimited.

typeHeader​

Name of the column holding the operation type (upsert or delete). Default is type.