Skip to content

Commit d36c385

Browse files
Merge pull request #37 from neo4j-graph-examples/revert-36-add-indexes-to-movies
Revert "add indexes and constraints content"
2 parents 0f967b6 + 4ad3cb2 commit d36c385

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

documentation/movies.workspace.adoc

+3-16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ image::movie-model.png[]
3535

3636
[source,cypher]
3737
----
38+
CREATE CONSTRAINT movie_title IF NOT EXISTS FOR (m:Movie) REQUIRE m.title IS UNIQUE;
39+
CREATE CONSTRAINT person_name IF NOT EXISTS FOR (p:Person) REQUIRE p.name IS UNIQUE;
40+
3841
MERGE (TheMatrix:Movie {title:'The Matrix'}) ON CREATE SET TheMatrix.released=1999, TheMatrix.tagline='Welcome to the Real World'
3942
4043
MERGE (Keanu:Person {name:'Keanu Reeves'}) ON CREATE SET Keanu.born=1964
@@ -699,22 +702,6 @@ MATCH path = (person)-[:ACTED_IN]->(m)<-[:DIRECTED]-(d)
699702
RETURN path;
700703
----
701704

702-
To aid query performance, you can add indexes to your data.
703-
(The dataset you create in this guide is very small, but it is good practice to use indexes as they can greatly improve query performance when the datasets are larger.)
704-
705-
In this small dataset, you are mainly interested in names of people and titles of movies.
706-
Run the following to add indexes on these properties
707-
708-
[source,cypher]
709-
----
710-
CREATE INDEX person_name FOR (p:Person) ON (p.name);
711-
CREATE INDEX movie_title FOR (m:Movie) ON (m.title)
712-
----
713-
714-
Note that you can also add constraints to your data to ensure uniqueness for example.
715-
Adding constraints automatically adds a correpsonding index.
716-
See link:https://neo4j.com/docs/cypher-manual/current/constraints/[Cypher Manual -> Constraints^] for more information.
717-
718705
In the next step, you will look for nodes and their properties.
719706

720707
== Find nodes

0 commit comments

Comments
 (0)