Indexes are currently only used for direct, exact lookups, no range queries.

The query you run is a global database scan (on the label), if you need to 
perform that kind of query more often (what is your use-case for that??), you 
would create some in-graph structures that support this use-case (like a tree).

Michael

Am 03.03.2014 um 13:01 schrieb Pablo Coralio Ballester 
<coralio.balles...@gmail.com>:

> Hi there,
> 
> I have 5 million of nodes of type :User with an integer property "Value", 
> which has a schema indexed created:
> 
> CREATE INDEX ON :User(Value)
> 
> I expected the following query to use the index but actually it doesn't seem 
> so:
> 
> MATCH (u:User)
> WHERE u.value>1000
> RETURN count(u)
> 
> In fact, specifying the index as follows
> 
> MATCH (u:User)
> USING INDEX u:User(Value)
> WHERE u.value>1000
> RETURN count(u)
> 
> gives me an error: 
> "Cannot use index hint in this context. The label and property comparison 
> must be specified on a non-optional node
> Label: `User`
> Property name: `Value`
> 
> 
> It looks like Neo4J only uses the index in case of queries of the form "WHEE 
> u.Value=1000". However, I would like to use the index in order to make this 
> search fast. The query above is taking more than 12 secs., which is simply 
> unacceptable.
> 
> Thanks!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to