【问题标题】:ArangoDB WITHIN and NEAR queries never return resultsArangoDB WITHIN 和 NEAR 查询从不返回结果
【发布时间】:2017-11-21 19:14:06
【问题描述】:

我正在尝试在 arangodb 中运行一些地理查询,但没有得到结果。 这是我尝试过的

Created index (in java)
 final Collection<String> fields = new ArrayList<String>();
 fields.add("latitude");
 fields.add("longitude");
 db.collection("foo").ensureGeoIndex(fields,null);

验证网页界面中是否存在索引

ID  Type    Unique  Sparse  Deduplicate Selectivity Est.    Fields
13362   geo2    false   true    n/a n/a latitude, longitude

来自网络界面的示例 foo 记录

{"properties":{"latitude":37.78808138412046,"longitude":-122.080078125}}

从网页界面的查询窗口

FOR doc IN NEAR(@@collection, @latitude, @longitude, @limit) 
    RETURN doc

binding
    @collection foo
    latitude 37.78808138412046
    longitude -122.080078125
    limit 50

即使我有大量具有确切位置的记录,也总是返回一个空数组

Info: 
using storage engine mmfiles
ArangoDB 3.2.8 [darwin] 64bit, using jemalloc, VPack 0.1.30, RocksDB 5.6.0, ICU 58.1, V8 5.7.492.77, OpenSSL 1.0.2k 26 Jan 2017

【问题讨论】:

  • 我想通了。我将位置值嵌套在属性对象中,而不是将其作为顶级字段

标签: arangodb


【解决方案1】:

只是为了完成问题,不要将位置字段放在对象的嵌套属性中 - 这是我的问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-29
    • 1970-01-01
    • 1970-01-01
    • 2014-12-04
    • 2021-07-31
    • 2019-09-18
    相关资源
    最近更新 更多