Neo4j 通过批处理添加时未创建空间索引
我正在尝试通过批处理填充WKT节点 空间索引名称为“Geocode”,批处理创建lucene索引“Geocode-neo4j_spatial…”当我对“Geocode”索引执行“WithindDistance”密码时,我得到“index not Existence”错误 有人能帮我一下我下面的代码有什么遗漏/错误吗Neo4j 通过批处理添加时未创建空间索引,neo4j,neo4j-spatial,Neo4j,Neo4j Spatial,我正在尝试通过批处理填充WKT节点 空间索引名称为“Geocode”,批处理创建lucene索引“Geocode-neo4j_spatial…”当我对“Geocode”索引执行“WithindDistance”密码时,我得到“index not Existence”错误 有人能帮我一下我下面的代码有什么遗漏/错误吗 IndexImplementation indexImpl = new SpatialIndexImplementation(graphService); //Creatin
IndexImplementation indexImpl = new SpatialIndexImplementation(graphService);
//Creating Index. I see that the associated lucene index is getting created
Index<Node nodeIndex = indexImpl.nodeIndex("Geocode", SpatialIndexProvider.SIMPLE_WKT_CONFIG);
Label label = DynamicLabel.label("Address");
GlobalGraphOperations global = GlobalGraphOperations.at(graphService);
Iterable<Node allNodes = global.getAllNodesWithLabel(label);
for(Node node: allNodes){
if(node.hasProperty("addressLine1")){
//Adding to the Spatial Index. I see that LayerNodeIndex.add method is called
nodeIndex.add(node, "addressLine1",
node.getProperty("addressLine1"));
}
我认为你的索引创建是错误的 应该是:
gdb.index().forNodes("GeoCode",SpatialIndexProvider.SIMPLE_WKT_CONFIG);
所有的impl工作都应该在服务器端进行。我通过SDN添加了一个正确创建索引的节点,然后使用批插入加载其余节点,从而实现了这一点。尽管如此,找出上面代码中的错误还是很有帮助的。无论您为索引提供了哪个键/值,它都只是在您的案例wkt中使用配置的属性,并且它不应该为地理代码本身创建lucene索引,而应该创建图内空间索引。