Indexes are exact lookups.

Except if you did a manual numeric legacy indexes

db.index().forNodes("member_age").add(node,"birth_year",ValueContext.numeric(node.get("birth_year"));

db.index().forNodes("member_age").query(NumericRangeQuery.newIntRange("birth_year",
 from , to, true, true));



    @Override
    public EndResult<T> findAllByRange(final String indexName, final String 
property, final Number from, final Number to) {
        return queryResult(indexName, new Query<S>() {
            public IndexHits<S> query(ReadableIndex<S> index) {
                return index.query(property, 
createInclusiveRangeQuery(property, from, to));
            }
        });
    }

    @SuppressWarnings("unchecked")
    protected <T extends Number> NumericRangeQuery<T> 
createInclusiveRangeQuery(String property, Number from, Number to) {
        if (from instanceof Long) return (NumericRangeQuery<T>) 
NumericRangeQuery.newLongRange(property, 
from.longValue(),to.longValue(),true,true);
        if (from instanceof Integer) return (NumericRangeQuery<T>) 
NumericRangeQuery.newIntRange(property, from.intValue(), to.intValue(), true, 
true);
        if (from instanceof Double) return (NumericRangeQuery<T>) 
NumericRangeQuery.newDoubleRange(property, from.doubleValue(), 
to.doubleValue(), true, true);
        if (from instanceof Float) return (NumericRangeQuery<T>) 
NumericRangeQuery.newFloatRange(property, from.floatValue(), to.floatValue(), 
true, true);
        return (NumericRangeQuery<T>) NumericRangeQuery.newIntRange(property, 
from.intValue(), to.intValue(), true, true);
    }


Am 17.01.2014 um 21:07 schrieb Javad Karabi <[email protected]>:

> is it possible to accomplish this using gremlin, or the java api?
> that is, if i was to attempt to search for nodes with birth_year > x, via 
> gremlin or java, would the index be used?
> 
> 
> On Fri, Jan 17, 2014 at 10:47 AM, Michael Hunger 
> <[email protected]> wrote:
> Something like that is planned to be adressed in 2.1
> 
> Sent from mobile device
> 
> Am 17.01.2014 um 16:54 schrieb Javad Karabi <[email protected]>:
> 
>> on a similar note, 
>> 
>> MATCH (p:Product)<-[c:contains]-(w:Warehouse)
>> WHERE c.available = 1
>> RETURN p
>> 
>> is it possible to create an index on the contains relationship, and 
>> available attribute, such that this query could lookup the index to perform 
>> faster?
>> 
>> 
>> 
>> On Fri, Jan 17, 2014 at 9:47 AM, Michael Hunger 
>> <[email protected]> wrote:
>> No range queries are planned after 2.1
>> 
>> Sent from mobile device
>> 
>> Am 17.01.2014 um 16:38 schrieb Javad Karabi <[email protected]>:
>> 
>>> for example, i executed (once with and without index one 
>>> :Member(birth_year) ):
>>> 
>>> MATCH (m:Member)
>>> WHERE m.birth_year > 1980 AND m.birth_year < 2000
>>> RETURN m
>>> 
>>> and i noticed that the time to perform the query did not change.
>>> 
>>> this led me to believe that the index did not help.
>>> does this mean that the index does not help when performing > and < in a 
>>> WHERE clause?
>>> 
>>> -- 
>>> 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 [email protected].
>>> 
>>> For more options, visit https://groups.google.com/groups/opt_out.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Neo4j" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/neo4j/t_9WyTuI4rQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected].
>> 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 [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Neo4j" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/neo4j/t_9WyTuI4rQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to