Adding to Michael's comment... the fact that range-based queries aren't currently using an index is not an inherent or permanent limitation by any means. It will be addressed as part of the ongoing work that's happening to improve the Cypher optimizer. There's lots of exciting work happening here in 2.1 (and beyond). Stay tuned...
In the short term, a couple workarounds when Cypher queries don't perform as you'd like them to, include hand-tuning Cypher queries (or the graph as Michael suggested), or if all else fails, dropping down into the native Java API via an unmanaged extension. Fortunately most queries don't require this today (some do) and over time it will quickly become a rarity. -Philip On Wed, Mar 5, 2014 at 12:47 PM, Pablo Coralio Ballester < coralio.balles...@gmail.com> wrote: > Thanks, is this something common to other database engines? I don't know > if I'm demanding too much or if Neo4J is just not suited to my needs, but I > find this to be a bit disappointing. > > > On Monday, March 3, 2014 3:25:33 PM UTC+1, Michael Hunger wrote: > >> 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....@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+un...@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. > -- *Philip Rathle* VP of Products | Neo Technology +1.650.918.9595 | @prathle -- 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.