Neo4j 中每个节点可以存储多少数据
我需要在 Neo4j 节点中保存大块 Unicode 文本字符串。该文档没有提及每个节点可以存储的数据大小。
有人知道吗?
I need to save big chunks of Unicode text strings in Neo4j nodes. The documentation does not mention anything about the size of data one can store per node.
Does anyone know that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Neo4j 默认使用 Lucene 进行索引。 Lucene 被构建为全文搜索工具箱(Solr 是事实上的搜索引擎实现)。由于 Lucene 旨在搜索大量文本,因此我怀疑您可以将任意多的文本放入节点中,并且它会正常工作。
Neo4j is by default indexed using Lucene. Lucene was built as a full text search toolbox (with Solr being the de facto search engine implementation). Since Lucene was intended to search over large amounts of text, my suspicion is that you can put as much text into a node as you want and it will work just fine.
我刚刚使用 Neo4j Web 界面尝试了以下操作:
我编写了一行 26 个字符,并复制了 32000 行,总共 832000 个字符。
我创建了一个具有“文本”属性的节点,并将我的文本复制到其中,它工作得很好。
我再次尝试了 64000 行,行尾有空格,总共 1728000 个字符。创建一个新节点,然后查询该节点并将结果复制回文件中以检查大小(你永远不知道),然后 wc 给了我 1728001 (我想这一定是复制/粘贴过程中的错误)。
它似乎没有抱怨。
仅供参考,这相当于一篇平均大小为 4 个空格(5 个字符)的 345600 个单词的文本,以及一本 1000 页、每页 300 个单词的书。
但是,我不知道如果节点太多,这会如何影响性能。如果因此不能很好地工作,您总是可以考虑使用 neo4j 来存储有关关系的信息,使用属性 ID 作为另一个面向文档的数据库的 id 来检索文本(或者简单地将文件的路径作为路径)财产)。
I just tried the following with the neo4j web interface :
I wrote a line of 26 characters and duplicated it through 32000 lines, which makes a total of 832000 characters.
I created a node with a property "text" and copied my text in it, and it worked perfectly.
I tried again with 64000 lines with white spaces at the end of lines, with a total of 1728000 characters. Created a new node, then queried the node and copied the result back in a file to check the size (you never know), and wc gave me 1728001 (the one must be an error in the copy/paste process I suppose).
It didn't seem to complain.
FYI this is equivalent to a text with 345600 words of an average size of 4 and a space (5 characters), and a book of 1000 pages with 300 words per page.
I don't know however how this could impact performances if there are too many nodes. If it doesn't work well because of this, you could always consider having neo4j for storing informations about relationships, with a property ID as an id for another document oriented database to retrieve the text (or simply the path of a file as a path property).
Neo4j 是管理对象之间关系的一个非常好的解决方案。您可能已经知道,这些关系以及节点本身都可以具有属性。但我认为你不能在这些节点上存储“一大块”数据。我认为 Neo4j 旨在与其他数据库(例如 MongoDb 甚至 mysql)一起使用。您“非常快”地获得您首先需要的信息,然后使用另一个引擎查找它。在我的项目中,我存储用户名、姓名、出生日期、ID 和此类信息,但不是非常大的文本字符串。
Neo4j is a very nice solution for managing relationships between objects. As you may already know these relationships can have properties as well as the nodes themselves. But I think you cannot store "a big chunk" of data on these nodes. I think Neo4j was intended to be used with another database such as MongoDb or even mysql. You get "really fast" the information you first need and then look up for it using another engine. On my projects I store usernames, names, date of birth, ids, and these kind of information, but not very large text strings.