Reputation: 88
I need a query to fetch all properties of a relation that are not empty, e.g.
MATCH ()-[r:TYPE]-() WHERE r.attr <> "" RETURN r.attr
I would guess that CREATE INDEX ON :TYPE(attr)
creates an Index on a Node with the label TYPE and not on a relation property?
Or is it not necessary to create an index on a relation property?
I am using neo4j 2.2.3.
Upvotes: 0
Views: 1177
Reputation: 39925
Indexes on relationships are only possible by using manual indexes.
Bevor creating those I strongly recommend rethinking your graph model. Everything being an entity or a complex value type should be modeled as nodes. The interaction between the things in your world are modeled as relationships. Typically relationships use weight parameters or metadata for their properties but rarely real attributes.
Since your queries typically start at "something" (aka a thing aka a node) you most likely don't need relationship indexes. Indexes should only be used for identifying the start points for your traversals.
Upvotes: 2