1
votes

I am trying to run some geo queries in arangodb and not getting results. Here is what I have tried

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

Verify index exist in the web interface

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

Example foo record from web interface

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

From the QUERIES window in the web interface

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

binding
    @collection foo
    latitude 37.78808138412046
    longitude -122.080078125
    limit 50

Always returns an empty array even though I have loads of records with the exact location

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
1
I figured it out. I was nesting the location values in the properties object instead up bringing it up as a top level fieldJeff I

1 Answers

0
votes

Just to complete the question, do not put the location fields in the nested properties of an object - this is what was my issue