Unless you have specific reasons to use the legacy indexing, see [tutorials-java-embedded-new-index] instead.
Note
|
Please read [tutorials-java-embedded-resource-iteration] on how to properly close ResourceIterators returned from index lookups.
|
You have a user database, and want to retrieve users by name using the legacy indexing system.
Tip
|
The source code used in this example is found here: EmbeddedNeo4jWithIndexing.java |
We have created two helper methods to handle user names and adding users to the database:
component=neo4j-examples source=org/neo4j/examples/EmbeddedNeo4jWithIndexing.java classifier=sources tag=helperMethods
The next step is to start the database server:
component=neo4j-examples source=org/neo4j/examples/EmbeddedNeo4jWithIndexing.java classifier=sources tag=startDb
It’s time to add the users:
component=neo4j-examples source=org/neo4j/examples/EmbeddedNeo4jWithIndexing.java classifier=sources tag=addUsers
And here’s how to find a user by Id:
component=neo4j-examples source=org/neo4j/examples/EmbeddedNeo4jWithIndexing.java classifier=sources tag=findUser