2017-02-09 38 views
1

OrientDB已經從2.2升級到Spatial Module功能。如何爲OrientDB(2.2.x)創建空間模塊的索引?

什麼是Java等同於創建這個索引:

CREATE INDEX ON(幾何場)空間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(); 

Ref:http://orientdb.com/docs/2.2/Spatial-Index.html

(我在這裏看到一些代碼:http://orientdb.com/docs/2.1/Spatial-Index.html],但似乎這是對以前版本的「空間索引」,而不是「空間模塊」從2.2起)。

+0

請參閱更新的文檔:http://orientdb.com/docs/last/Spatial-Index.html –

回答

1

您可以通過Java創建使用OSQL索引:

db.command(new OCommandSQL("CREATE INDEX Restaurant.location ON Restaurant(location) SPATIAL ENGINE LUCENE")).execute(); 
相關問題