cancel
Showing results for 
Search instead for 
Did you mean: 

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

apankraz
Node Link

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 🙂 

1 ACCEPTED SOLUTION

@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

View solution in original post

4 REPLIES 4

@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-arr...

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.