Database Reference
In-Depth Information
2 . Do a traversal starting from the node found in step 1.
How do you apply this pattern with Cypher? Cypher queries work by using pattern match-
ing, so the typical usage would look like this:
1 . Look up one or more nodes using the Lucene index.
2 . Perform pattern matching by attaching the nodes you looked up in step 1 to the
pattern.
3 . Return the entities you're interested in.
The only question now is how to perform the Lucene index lookup in the start clause
of the Cypher query instead of loading nodes by ID. It's very simple, as illustrated in this
snippet:
The start clause syntax is slightly different now. The node:users part specifies that
you're interested in a node from the users index. The index name must match the index
name you used when you added the node to the index. The arguments in parentheses spe-
cify the key-value pair you're looking for in the index; in this case, you're matching the
property name with the value "John Johnson" . If such an index entry is found in the
users index, that node will be loaded from the Neo4j database and used in the Cypher
query.
This index lookup syntax requires an exact match of the key-value pair, and it is case-
sensitive, so nodes with a name property of "john johnson" or "John Johnso"
wouldn't be returned. At the same time, if multiple nodes are indexed with the same key-
value pair (if you had more than one John Johnson in the database), all matching nodes
would be loaded; it behaves similarly to the earlier example with multiple IDs.
If you want to use the full power of Lucene queries to look up start nodes, you can use a
slightly different syntax with a native Lucene query:
Search WWH ::




Custom Search