使用orientdb-enterprise-2.2.21和orientdb-community-2.2.21的空间索引问题

使用orientdb-enterprise-2.2.21和orientdb-community-2.2.21的空间索引问题,orientdb,orientdb2.2,Orientdb,Orientdb2.2,我试图通过使用orientdb-orientdb-enterprise-2.2.21的JavaAPI创建一个空间索引。使用远程连接运行测试。我尝试使用几种方法创建类,并创建了属性 nodeClass = graph.createVertexType(NODE_CLASS_NAME); nodeClass.createProperty("latitude", OType.DOUBLE); nodeClass.createProperty("longi

我试图通过使用orientdb-orientdb-enterprise-2.2.21的JavaAPI创建一个空间索引。使用远程连接运行测试。我尝试使用几种方法创建类,并创建了属性

        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); 
结果是:

我用几种方法创建空间索引,但都失败了:

案例1“老办法”:

结果:

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

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

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

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

2.2.21
2.6.0
面向对象技术
定向数据库图形
${orientdb.version}
面向对象技术
定向数据库空间
${orientdb.version}
面向对象技术
orientdb lucene
${orientdb.version}
小精灵
小精灵groovy
${tinkerpop.version}
小精灵
小鬼
${tinkerpop.version}

有人有什么建议吗?orientdb-community-2.2.21遇到了相同的行为。

您是否在服务器上安装了spatial插件


感谢您的反馈,确实有所帮助。但是,我必须使用嵌入式SQL创建属性和索引才能使其工作。这是它工作的唯一方式:OCommandRequest commandRequest=graph.command(新的OCommandSQL(“在组(位置)空间引擎LUCENE上创建索引组.location”);为了清楚起见,我首先需要->(1)graph.command(新的OCommandSQL(“CREATE PROPERTY Group.location EMBEDDED OPoint”).execute();然后->(2)OCommandRequest commandRequest=graph.command(新的OCommandSQL(“在组(位置)空间引擎LUCENE上创建索引组.location”);要从Java执行此操作似乎有点尴尬。感谢您提供的信息。