Playframework 如何在GraphRespository和Neo4j空间索引中存储节点

Playframework 如何在GraphRespository和Neo4j空间索引中存储节点,playframework,spring-data-neo4j,neo4j-spatial,Playframework,Spring Data Neo4j,Neo4j Spatial,我在游戏中使用Neo4j Spatial和Spring数据!框架应用程序 我有一个User类型的@NodeEntity,我想将它存储在数据库中,还有一个用于基于位置的查询的空间索引 我看到的示例使用GraphDatabaseService创建节点: Node stadiumNode = graphDatabaseService.createNode(); 然后将此节点添加到空间索引: Index<Node> index = graphDatabaseService.index().

我在游戏中使用Neo4j SpatialSpring数据!框架应用程序

我有一个User类型的@NodeEntity,我想将它存储在数据库中,还有一个用于基于位置的查询的空间索引

我看到的示例使用GraphDatabaseService创建节点:

Node stadiumNode = graphDatabaseService.createNode();
然后将此节点添加到空间索引:

Index<Node> index = graphDatabaseService.index().forNodes(indexLayerName, config)`;
stadiumNode.setProperty("wkt", String.format("POINT(%s %s)", lat, lon)); 
index.add(stadiumNode, "dummyA", "dummyB");
然后将用户节点添加到存储库:

User user = new User();
userRepository.save(user);
但是,这将创建3个节点(1个在空间索引RTree中,2个在neo4j图中)。正确的做法是什么?我只需要2个节点:

  • neo4j图形中用户类型的一个节点
  • 一个节点,包含与上述节点关联的位置信息
  • User user = new User();
    userRepository.save(user);