OrientDB已从2.2升级到Spatial Module功能。
为此创建索引的 Java 等效项是什么:
CREATE INDEX ON (geometry-field) SPATIAL ENGINE LUCENE
举个例子:
ODocument location = new ODocument("OPoint");
location.field("coordinates", Arrays.asList(12.4684635, 41.8914114));
ODocument doc = new ODocument("Restaurant");
doc.field("name","Dar Poeta");
doc.field("location",location);
doc.save();
引用号:http://orientdb.com/docs/2.2/Spatial-Index.html
(我在这里看到了一些代码:[ http://orientdb.com/docs/2.1/Spatial-Index.html] 但似乎这是针对以前版本的“空间索引”,而不是 2.2 以后的“空间模块”。)
最佳答案
您可以通过 Java 使用 OSQL 创建索引:
db.command(new OCommandSQL("CREATE INDEX Restaurant.location ON Restaurant(location) SPATIAL ENGINE LUCENE")).execute();
关于java - 如何为 OrientDB (2.2.x) 的空间模块创建索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42134472/