Example query:
WITH ["sword", "Sword", "blade", "Blade", "katana", "Katana"] AS weapons
MATCH (s:Set)
WHERE s.name IN weapons
RETURN s
Neo4j documentation mentions that both Range index and Text index should be used when we check for list membership. Which one is actually better in the example above where the list contains only strings?
I could not find information in Neo4j documentation about which index should I should choose to speed up these queries.
What about a more compliacted example which uses any() with CONTAINS?:
WITH ["sword", "blade", "katana"] AS weapons
MATCH (s:Set)
WHERE ANY(piece IN weapons WHERE toLower(s.name) CONTAINS piece)
RETURN s
From the documentation
If you need CONTAINS, TEXT indexes are way faster than RANGE.
That said, based on your query, TEXT indexes are case sensitive and trying to lowercase the value of properties for comparison will prevent the index usage.