Skip to content

Commit f65d655

Browse files
Clarify text index use (#1028)
1 parent 3519a08 commit f65d655

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

modules/ROOT/pages/query-tuning/indexes.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,26 @@ In summary, `TEXT` indexes support the following predicates:
8484

8585
|===
8686

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+
87107
== Index preference
88108

89109
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

Comments
 (0)