Skip to main content

Neo4jCommitter

Commit documents to a Neo4j graph database.

Notes​

Commits crawled documents to a Neo4j graph database using configurable Cypher queries for upserts and deletes. Field mappings, multi-value joining, and optional parameters for missing fields are supported.

Examples​

Creates or updates one node per crawled document, keyed on its reference.

committer:
class: Neo4jCommitter
uri: bolt://localhost:7687
credentials:
username: neo4j
password: changeme
database: neo4j
nodeIdProperty: id
nodeContentProperty: content
upsertCypher: "MERGE (d:Document {id: $id}) SET d.content = $content, d.title = $title"

Usage​

Full configuration skeleton, with every option and its default
class: Neo4jCommitter
acl:
flatPrefix: string
format: NATIVE
partial: REJECT
credentials:
password: string
passwordKey:
size: 0
source: KEY
value: string
username: string
database: string
deleteCypher: string
fieldMappings: {}
multiValuesJoiner: string
nodeContentProperty: string
nodeIdProperty: string
optionalParameters:
- string
queue:
class: FsQueue
batchSize: 0
commitLeftoversOnInit: false
maxPerFolder: 0
onCommitFailure:
ignoreErrors: false
maxRetries: 0
retryDelay: 0
splitBatch: OFF
restrictions:
- fieldMatcher: {}
valueMatcher: {}
upsertCypher: string
uri: string

Properties​

PropertyTypeRequiredDefault
aclAclCommitterConfigNoAclCommitterConfig
credentialsCredentialsNoCredentials
databasestringNo-
deleteCypherstringNo-
fieldMappingsRecord<string, string>No-
multiValuesJoinerstringNo-
nodeContentPropertystringNocontent
nodeIdPropertystringNoid
optionalParametersstring[]No-
queueCommitterQueueNoFsQueue
restrictionsPropertyMatcher[]No-
upsertCypherstringNo-
uristringNo-

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.

credentials​

Username and password to Neo4j.

database​

Database name when using one other than the default.

deleteCypher​

Cypher query for deleting relationships in Neo4j. Typically, you want to use "nodeIdProperty" value to delete nodes having a matching property value. The query parameters correspond the document fields.

fieldMappings​

Mapping of source fields to target ones (Neo4j property).

multiValuesJoiner​

Characters used to join a multi-valued field into the single value stored on the node. Default is |. Choose something that cannot appear in your values if you intend to split them apart again later.

nodeContentProperty​

Property name where to store the document content in Neo4j graph entries. Use it as a cypher parameter in your configured "upsertCypher" query. Default is "content".

nodeIdProperty​

Property name where to store the document reference in Neo4j graph entries. Use it as a cypher parameter to uniquely identify your graph entries in your configured "upsertCypher" and "deleteCypher" queries. Default is "id".

optionalParameters​

Comma-separated list of parameter names that can be missing when creating the query. They will be set to NullValue to avoid client exception for missing parameters.

queue​

Configures the committer queue used to batch documents before sending them to the target system. Adjust queue settings to tune throughput and memory usage.

restrictions​

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

upsertCypher​

Cypher query for adding relationships to Neo4j. Typically, you want to use MERGE and the "nodeIdProperty" value to update existing entries matching the ID. In order to later delete all nodes related to an entry, make sure to add the ID property on all appropriate nodes. The query parameters correspond the document fields.

uri​

Required connection URI. E.g., bolt://localhost:7687.