Cypher Indexes and Constraints: Check your understanding Question 2(index on an array)

Hi all,

the following assessment in the Cypher Indexes and Constraints course seems to be wrong and might actually lead to a wrongful implementation and assumption of index usage.

apankraz_0-1660658578666.png

As I understand non of the current available indexes would improve this query. Looking for a value in an indexed array property will in fact NOT use an index for lookup.

Please correct me if I am wrong and show me how an Index could be used on an actual multivalued property to find a specific value like in the example.

I would really, really like to be wrong about that :slightly_smiling_face:

@apankraz ,

This is a BAD question that needs to be rewritten. You are absolutely correct! Cypher does not (yet) support indexes on array elements. It will be a a future release.

Thank you for pointing this out. I will change the example.

Elaine

Hi Elaine,

how come there is a formula to compute the size of the key in the documentation for an index that is not used anyway?

https://neo4j.com/developer/kb/index-limitations-and-workaround/#index-configuration-limitations-arrays

That KB article is a general purpose description of how data is stored in the db.
In 5.0, there is now support for string arrays in full text indexes
https://neo4j.com/release-notes/database/neo4j-5/

I suppose you meant:


In 5.0, there is NOW support for string arrays in full text indexes

Nice. But I have to convert my integer IDs to strings, define a fulltext index using the keyword analyzer and then start all my queries by a procedure call to retrieve the matching nodes instead of letting the query planner do its job like with a normal index.

And it is still weird that in 4.4. you can define a b-tree index on any array property that will never get used.