Package com.norconex.committer.neo4j
Class Neo4jCommitter
java.lang.Object
com.norconex.committer.core3.AbstractCommitter
com.norconex.committer.core3.batch.AbstractBatchCommitter
com.norconex.committer.neo4j.Neo4jCommitter
- All Implemented Interfaces:
IBatchConsumer,ICommitter,IXMLConfigurable,AutoCloseable
Commit documents/fields to a Neo4j graph database.
Authentication
Basic authentication is supported for password-protected Solr installations.
XML configuration usage:
<committer
class="com.norconex.committer.neo4j.Neo4jCommitter">
<!--
Mandatory settings --->
<uri>
(Required connection URI. E.g., "bolt://localhost:7687".)
</uri>
<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 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.)
</upsertCypher>
<deleteCypher>
(Cypher query for adding relationships to Neo4j. Typically,
you want to use "nodeIdProperty" value to delete nodes having
a matching property value. The query parameters correspond the
document fields.)
</deleteCypher>
<!-- Optional settings --->
<database>
(A database name when using one other than the default one.)
</database>
<credentials>
</credentials>
<multiValuesJoiner>
(One or more characters to join multi-value fields. Default is "|".)
</multiValuesJoiner>
<nodeIdProperty>
(Optional 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".)
</nodeIdProperty>
<nodeContentProperty>
(Optional 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".)
</nodeContentProperty>
<optionalParameters>
(Comma-separated list of parameter names that can be missing when
creating the query. They will be set to {@link NullValue}) to avoid
client exception for missing parameters.)
<optionalParameters>
</committ
-->
XML usage example:
<committer
class="com.norconex.committer.neo4j.Neo4jCommitter">
<uri>bolt://localhost:7687</uri>
<upsertCypher>
MERGE (a:Document { docId: $id })
SET a += { title: $title }
SET a += { author: $author }
</upsertCypher>
<deleteCypher>
MATCH (a:Document { docId: $id })
DETACH DELETE a
</deleteCypher>
<credentials>
<username>neo4j</username>
<password>AcwFJPHITfk6LrRp7HW7Ag6hvDZotXcvWt2WvDMcGIo=</password>
<passwordKey>
<value>key.txt</value>
<source>file</source>
</passwordKey>
</credentials>
<multiValuesJoiner>_</multiValuesJoiner>
</committer>
The above example creates a graph of collected documents.
- Author:
- Sylvain Roussy, Pascal Essiembre
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Neo4j committer with default configuration.Neo4jCommitter(Neo4jCommitterConfig config) Creates a new Neo4j committer with the given configuration. -
Method Summary
Methods inherited from class com.norconex.committer.core3.batch.AbstractBatchCommitter
consume, doClean, doClose, doDelete, doInit, doUpsert, getCommitterQueue, loadCommitterFromXML, saveCommitterToXML, setCommitterQueueMethods inherited from class com.norconex.committer.core3.AbstractCommitter
accept, addRestriction, addRestrictions, applyFieldMappings, clean, clearFieldMappings, clearRestrictions, close, delete, fireDebug, fireDebug, fireError, fireError, fireInfo, fireInfo, getCommitterContext, getFieldMappings, getRestrictions, init, loadFromXML, removeFieldMapping, removeRestriction, removeRestriction, saveToXML, setFieldMapping, setFieldMappings, upsertMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.norconex.commons.lang.xml.IXMLConfigurable
loadFromXML, saveToXML
-
Constructor Details
-
Neo4jCommitter
public Neo4jCommitter()Creates a new Neo4j committer with default configuration. -
Neo4jCommitter
Creates a new Neo4j committer with the given configuration.- Parameters:
config- committer configuration
-
-
Method Details
-
initBatchCommitter
- Overrides:
initBatchCommitterin classAbstractBatchCommitter- Throws:
CommitterException
-
commitBatch
- Specified by:
commitBatchin classAbstractBatchCommitter- Throws:
CommitterException
-
closeBatchCommitter
- Overrides:
closeBatchCommitterin classAbstractBatchCommitter- Throws:
CommitterException
-
getConfig
Gets this committer's configuration.- Returns:
- committer configuration
-
loadBatchCommitterFromXML
- Specified by:
loadBatchCommitterFromXMLin classAbstractBatchCommitter
-
saveBatchCommitterToXML
- Specified by:
saveBatchCommitterToXMLin classAbstractBatchCommitter
-
equals
- Overrides:
equalsin classAbstractBatchCommitter
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractBatchCommitter
-
toString
- Overrides:
toStringin classAbstractBatchCommitter
-