You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/query-tuning/indexes.adoc
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,26 @@ In summary, `TEXT` indexes support the following predicates:
84
84
85
85
|===
86
86
87
+
=== Ensuring text index use
88
+
89
+
In order for the planner to use text indexes, it must be able to confirm that the properties included in the predicate are `STRING` values.
90
+
This is not possible when accessing property values within nodes or relationships, or values within a `MAP`, since Cypher does not store the type information of these values.
91
+
To ensure text indexes are used in these cases, the xref:functions/string.adoc#functions-tostring[`toString`] function should be used.
92
+
93
+
.Text index not used
94
+
[source,cypher]
95
+
----
96
+
WITH {name: 'John'} AS varName
97
+
MERGE (:Person {name:varName.name})
98
+
----
99
+
100
+
.Text index used
101
+
[source,cypher]
102
+
----
103
+
WITH {name: 'John'} AS varName
104
+
MERGE (:Person {name: toString(varName.name)})
105
+
----
106
+
87
107
== Index preference
88
108
89
109
When multiple indexes are available and able to solve a predicate, there is an order defined that decides which index to use.
0 commit comments