How to use NEAR operator

Hi, I want to use the Lucene spatial indexes and I’m following the instructions of this page (I’m using version 3.0.30). I have a class Loc with lat and lon properties of type double. I did:

CREATE INDEX loc_geo ON Loc(lat, lon) SPATIAL ENGINE LUCENE;

But when I want to query like this (from console or Studio):

SELECT FROM Loc WHERE [lat, lon] NEAR [-31.880276, -60.885071];

it throws a java.lang.UnsupportedOperationException: NEAR operator cannot be evaluated in this context. In the server side it logs nothing.

What I’m doing wrong?

Hi @johny65

the near operator is kind of deprecated. You should use the latest spatial index features with functions

https://orientdb.com/docs/last/Spatial-Index.html#stdwithin

Ah, ok, I’ll try those then. Thanks.