2017-06-16 8 views
0

Ich versuche, einen räumlichen Index über die Java-API zu erstellen, die ich Orient DB Orientdb-Enterprise-2.2.21 verwende. Ausführen der Tests mit einer Remoteverbindung. Ich habe versucht, mit mehreren Ansätzen zu erstellen Klasse und Eigenschaften wurden erstellt.Räumliche Indexprobleme mit orientdb-enterprise-2.2.21 und orientdb-community-2.2.21

 nodeClass = graph.createVertexType(NODE_CLASS_NAME); 
     nodeClass.createProperty("latitude", OType.DOUBLE); 
     nodeClass.createProperty("longitude", OType.DOUBLE); 
     nodeClass.createProperty("name", OType.STRING); 
     nodeClass.createProperty("color", OType.STRING); 
     nodeClass.createProperty("location", OType.EMBEDDED); 

und die Ergebnisse sind:

ich einen räumlichen Index in mehrfacher Hinsicht bin die Schaffung und sie alle scheitern:

Fall 1 die "alten Weg":

nodeClass.createIndex("Group.latitude_longitude", "SPATIAL", null, null, "LUCENE", new String[] { "latitude", "longitude" }); 

Ergebnisse :

Exception in thread "main" com.orientechnologies.orient.core.index.OIndexException: Index with type SPATIAL and algorithm null does not exist. 
    DB name="demodb" 

Fall 2:

 graph.command(new OCommandSQL(
     "CREATE INDEX Group.location ON Group(location) SPATIAL ENGINE LUCENE")).execute(); 

Ergebnisse:

Exception in thread "main" com.orientechnologies.orient.core.index.OIndexException: Index with type SPATIAL and algorithm null does not exist. 
    DB name="demodb" 

Fall 3:

 OIndex<?> idx = nodeClass.getProperty("location"). 
       createIndex(OClass.INDEX_TYPE.SPATIAL, new ODocument().field("ignoreNullValues", true)); 

Ergebnisse:

Exception in thread "main" com.orientechnologies.orient.core.index.OIndexException: Index with type SPATIAL and algorithm null does not exist. 
    DB name="demodb" 

pom:

<orientdb.version>2.2.21</orientdb.version> 
<tinkerpop.version>2.6.0</tinkerpop.version> 
    <dependency> 
     <groupId>com.orientechnologies</groupId> 
     <artifactId>orientdb-graphdb</artifactId> 
     <version>${orientdb.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.orientechnologies</groupId> 
     <artifactId>orientdb-spatial</artifactId> 
     <version>${orientdb.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.orientechnologies</groupId> 
     <artifactId>orientdb-lucene</artifactId> 
     <version>${orientdb.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.tinkerpop.gremlin</groupId> 
     <artifactId>gremlin-groovy</artifactId> 
     <version>${tinkerpop.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.tinkerpop.gremlin</groupId> 
     <artifactId>gremlin</artifactId> 
     <version>${tinkerpop.version}</version> 
    </dependency> 

Hat jemand irgendwelche Vorschläge? Das gleiche Verhalten wurde mit orientdb-community-2.2.21 festgestellt.

Antwort

0

Haben Sie das räumliche Plugin auf dem Server installiert?

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

+0

Danke für das Feedback, das geholfen hat. Allerdings musste ich die Eigenschaft und den Index mithilfe von Embedded SQL erstellen, damit es funktioniert. Dies war der einzige Weg, wie es funktionierte: OCommandRequest commandRequest = graph.command (neue OCommandSQL ("CREATE INDEX Group.location ON Gruppe (Standort) SPATIAL ENGINE LUCENE")); – zambra33

+0

Um klar zu sein, brauchte ich zuerst -> (1) graph.command (new OCommandSQL ("CREATE PROPERTY Group.location EMBEDDED OPoint")). Execute(); Dann -> (2) OCommandRequest commandRequest = graph.command (neuer OCommandSQL ("CREATE INDEX Group.location ON Gruppe (location) SPATIAL ENGINE LUCENE")); Scheint nur ein wenig peinlich, dies von Java zu tun. Schätze die Informationen. – zambra33