match(n:City) detach delete n; drop CONSTRAINT ON (cc:City) ASSERT cc.location IS UNIQUE ;
create CONSTRAINT ON (cc:City) ASSERT cc.location IS UNIQUE ;
CREATE (bruges2:City {name:“bruges”, location:point({srid:4326, x: 101.585997,y: 30.342134})}); CREATE (bruges:City {name:“bruges”, location:point({srid:4326, x: 102.585997,y: 30.342134})}); CREATE (brussels:City {name:“brussels”, location:point({srid:4326, x: 103.585997,y: 30.342134})}); CREATE (paris:City {name:“paris”, location:point({srid:4326, x: 104.585997,y: 30.342134})}); CREATE (paris1:City {name:“paris1”, location:point({srid:4326, x: 105.585997,y: 30.342134})}); CREATE (paris2:City {name:“paris2”, location:point({srid:4326, x: 106.585997,y: 30.342134})}); /CREATE (paris3:City {name:“paris3”, location:point({srid:4326, x: 107.585997,y: 30.342134})})/
explain match(c:City) WHERE distance(c.location, point({srid:4326, x:104.585997, y: 30.342134 }))< 200 RETURN c; --City节点中超过5条数据就不走索引
explain MATCH (c:City) where point({srid:4326,x:100,y:21})<c.location<point({srid:4326,x:104,y:28}) return c; --可以走到索引