>我正在尝试通过批处理填充WKT节点。
空间索引名称为"地理编码",批处理将创建 lucene 索引"地理编码-neo4j_spatial...."。当我对"地理编码"索引执行"withinDistance"密码时,出现"索引不存在"错误。
有人可以帮助我下面的代码中缺少/错误吗?
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 的事情都应该发生在服务器端。