2

I am using a small Clojure script which batch-inserts nodes to my Neo4j instance. To show these nodes, I am using a spring-based webapp with Spring Data Neo4j. I also created a small domain object which represents the node.

When I insert a node by utilizing the webapp, it will be loaded and showed right out of the box. But when I try to load a node which has been inserted by the external script, it cannot be found. To be compatible, I thought it is sufficient enough to add the _type_ attribute with the FQN of the domain class. But it seems to me, that there's more to do.

I am using Neo4j 1.8.2 server and SDN 2.2.2

Can you give me a hint?

Thanks in advance.

Best, Markus

4

1 回答 1

5

Spring Data Neo4j (SDN) 使用TypeRepresentationStrategy. 如果 SDN 未明确配置,则默认使用IndexingNodeTypeRepresentationStrategyand 。IndexingRelationshipTypeRepresentationStrategy这些策略为其所有节点实体保留一个名为“__types__”的索引,为其所有关系实体保留一个名为“__rel_types__”的索引。SDN创建的所有节点或关系实体都将添加到相应的索引中。

如果您使用 SDN 的存储库基础架构并调用yourEntityRepo.findAll(),将查询“__types__”(或“__rel_types__”)索引以获取此特定类型的所有实体。

您的脚本可能不会更新这些索引。查看neo4j google group 中描述的重新索引解决方案

于 2013-08-19T21:05:25.683 回答