我正在使用Studio的OrientDB 2.0。我使用文档中的代码成功创建了Lucene空间索引:
CREATE class Place extends V
CREATE property Place.name string
CREATE property Place.latitude double
CREATE property Place.longitude double
CREATE INDEX Place.l_lon ON Place(latitude,longitude) SPATIAL ENGINE LUCENE
然后,我Place
使用latitude
和创建了一些对象longitude
。
当我尝试使用记录的格式进行空间搜索时
select from Class where [<lat-field>,<long-field>] NEAR [<x>,<y>]
搜索成功完成,没有错误,但是没有返回结果,即使我传递了其中一个Place
对象的确切坐标也是如此。
我也尝试过直接使用来查询索引
select from index:Place.l_lon
这也成功,没有出现错误,但未返回任何结果。我在想我的索引可能为空。我尝试从架构编辑器重建它,但仍然没有结果。而且,据我所知,无法手动将诸如位置坐标之类的复合条目添加到索引中。我想念什么吗?
尝试使用语法指定最大距离
select from Class where [<lat-field>,<long-field>,$spatial] NEAR [<x>,<y>,{"maxDistance": distance}]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句