In general moving property predicates from WHERE to MATCH makes no
difference. The Cypher compiler internally sees both formats as meaning the
exact same thing. MATCH can also only work with equality, not range, so
this example cannot move anyway, but if it could, it would not matter.

What will matter is whether there is an index on :country(createdAt). If
there is, the predicates can be passed to the index for faster search. If
not, it will search all countries and then filter.

And as Michael pointed out, you have two range predicates, both asking for
>= but with different times. Cypher will take the more restrictive one.
Perhaps you meant for the later time to be A <=, not a >=.

On Wed, Aug 8, 2018 at 8:08 PM, 'Michael Hunger' via Neo4j <
neo4j@googlegroups.com> wrote:

> Which version are you at?
>
> Are you sure this works? b/c you compare twice s.createdAT >= while you
> probably want to do a between?
>
>
>
> On Thu, Aug 2, 2018 at 4:06 PM, Imran Rajjad <raj...@gmail.com> wrote:
>
>> Hello,
>>
>> I have some tweets indexed in Neo4j for testing puproses.
>>
>> Below is a query that finds top hashtags from certain country
>>
>> match (c:country{countryCode:"US"})-[*0..4]->(s:status)-[*0..1]->(
>> h:hashtag)
>> where (s.createdAt >= datetime('2017-06-01T00:00:00') AND s.createdAt >=
>> datetime('2017-06-01T23:59:59'))
>> return h.name,count(h.name) as hCount
>> order by hCount desc
>> limit 100
>>
>> is it possible to move the datetime expression from WHERE into the MATCH
>> clause because it seems all the nodes are reached first and then filtered
>> through where clause. The "createdAt" field is a datetime field and has
>> been indexed
>>
>> thanks
>> Imran
>>
>> --
>> 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/d/optout.
>>
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to