Database Reference
In-Depth Information
Listing 5.1. Creating an index entry for a node using Neo4j API
First up, you create nodes using the Neo4j Core API and add properties ( ,
). Next,
you create an index and give it the name
users
( ,
)—this name will become the
unique identifier for this newly created index.
Finally,youaddthenodetotheindex
.Toaddanodetotheindex,youneedtoprovide
three parameters:
• The node you want to index (
personOne
)
• The index key (
"email"
)
• The indexed value (
jsmith@example.org
)
The index key and value are then stored by Lucene (Neo4j's default indexing implementa-
tion), along with the reference to the person node, as illustrated in
figure 5.1
.
If you'd like to configure the Lucene index, Neo4j allows to you pass in various configur-
ation options when the index is created. This can be done using the following method:
IndexManager.forNodes( String indexName, Map<String, String>
customConfiguration );
Map
customConfiguration
cancontainanyvalidLucenesetting.ForalistofLucene
configuration settings, see the Neo4j/Lucene documentation at
http://docs.neo4j.org/