首页 \ 问答 \ 在分布式系统中使用Neo4j和Lucene(Using Neo4j and Lucene in a distributed system)

在分布式系统中使用Neo4j和Lucene(Using Neo4j and Lucene in a distributed system)

我正在考虑将Neo4j作为精简文档存储。 文档存储的一个关键方面是搜索,我知道Neo4j包含Lucene提供的旧版索引的全文搜索。

我非常有兴趣听听分布式环境中Neo4j搜索功能的局限性。 它是否提供分布式索引? 它在哪些方面不如Solr或ElasticSearch? 在我必须安装Solr之前,我能在多长时间内接受它?

- 编辑 -

我们正在尝试整合两种不同的搜索工作。 第一种是标准文本内容搜索。 例如,使用安然电子邮件,我们希望搜索与“香蕉”或“去商店”匹配的每封电子邮件,并将这些文档正文作为回应。 这是人们经常求助于Solr的地方。

第二种情况比较复杂,我们在每个文档中附加了大量的元数据。 我们可能已经决定“这些”电子邮件是深夜醉酒拨号的结果。 现在我想搜索可能是深夜醉酒拨号结果的所有电子邮件。 对于这种元数据,我们认为图形数据库是有序的。

在一个完美的世界中,我可以使用一个平台来执行两个查询。 我很欣赏Neo4j(也不是OrientDB,Arango等)被设计为全文搜索数据库,但我试图理解其局限性。

就数量而言,我们正在进行大规模的批量式夜间更新。 数据内容繁重,有些文档会运行到数百页的文本中,但大多数都是一两页的顺序。


I am looking into Neo4j as a stripped-down document store. A key aspect of document storage is search, and I know Neo4j includes full text search via legacy indices provided by Lucene.

I would be very interested in hearing the limitations of Neo4j search capabilities in a distributed environment. Does it provide a distributed index? In what ways is it inferior to Solr or ElasticSearch? How far can I take it before I must install Solr?

-- EDIT --

We are trying to integrate two distinct search efforts. The first is standard text content search. For instance, using the Enron emails, we want to search for every email that matches "bananas" or "going to the store" and get those document bodies in response. This is where people often turn to Solr.

The second case is more complicated, we have attached a great deal of meta-data to each document. We may have decided that "these" emails were the result of late-night drunk-dialing. Now I want to search for all emails that may have been the result of late-night drunk-dialing. For this kind of meta-data, we believe a graph database is in order.

In a perfect world, I can use one platform to perform both queries. I appreciate that Neo4j (nor OrientDB, Arango, etc) are designed as full text search databases, but I'm trying to understand the limitations thereof.

In terms of volume, we are dealing at a very large scale with batch-style nightly updates. The data is content heavy, with some documents running into hundreds of pages of text, but mostly on the order of a page or two.


原文:https://stackoverflow.com/questions/31295830
更新时间:2022-06-26 13:06

最满意答案

capacity是字符串当前可以容纳的最大字符数,而不必增加。 size是字符串中实际存在的字符数。 他们分离概念的原因是分配内存通常效率低下,因此您尝试通过获取比实际需要的内存更少的内存来分配内存。 (许多数据结构使用“加倍”方法,如果它们的容量达到N并且需要更多空间,则它们将分配2*N空间,以避免不久后再次重新分配。)

当您使用字符串并且需要更多空间时, capacity会自动增加。 您也可以使用reserve功能手动增加它。


capacity is the maximum number of characters that the string can currently hold without having to grow. size is how many characters actually exist in the string. The reason they're separate concepts is that allocating memory is generally inefficient, so you try to allocate as rarely as possible by grabbing more memory than you actually need at one time. (Many data structures use a "doubling" method where, if they hit their capacity of N and need more space, they will allocate 2*N space, to avoid having to reallocate again any time soon.)

capacity will increase automatically as you use the string and require more space. You can also manually increase it using the reserve function.

相关问答

更多
  • 字符串的容量大小是否总是15的倍数? 没有; 关于std::string容量的唯一保证是s.capacity() >= s.size() 。 一个好的实现可能会使容量呈指数增长,这样每次需要重新分配底层数组时,它的容量就会扩大一倍。 这是std::vector所必需的,这样push_back可以具有分期恒定的时间复杂度,但是对于std::string没有这样的要求。 另外, std::string实现可以执行小型字符串优化,其中比std::string对象本身存储的字符数小于一定数量的字符,而不是存储在动态 ...
  • 该标准没有规定容器的初始capacity应该是什么,因此您依赖于实现。 一个共同的实施将开始在零的能力,但不能保证。 另一方面,没有办法改善你的策略std::vector iv; iv.reserve(2345); std::vector iv; iv.reserve(2345); 所以坚持下去 The standard doesn't specify what the initial capacity of a container should be, so you're relyin ...
  • 是的,您正确使用了getline 。 确保将其用作while循环或其他条件的条件: while(std::getline(fileIN, str1, '.')) { // process str1 } 并且不要犯这么多其他人试图使用fileIN.good()或!fileIN.eof()或其他任何东西的错误(这只会导致头痛和心痛)。 str1的缓冲区不需要由您清理,因为它由string类管理。 它将根据需要进行扩展,并在变量超出范围时解除分配。 这就是为什么我们喜欢标准库类并在使用原始数组之前三思而 ...
  • 你不能。 您必须循环并手动呼叫reserve 。 (就此而言, segments还没有vector ......如何在不存在的矢量中预留空间?:)) You can't. You have to loop through and call reserve manually. (And for that matter there are no vectors inside segments yet.. how could reserve space in a nonexistent vector? :) )
  • 这是一个很好的问题。 我将冒着火焰战争的风险,说用户代码中的capacity()调用是代码气味。 调用它的唯一原因是在操作中避免内存分配。 在这种情况下,更清晰且更容错的策略是创建一个自己的类(比如limited_length_string )。 可能的实现可能预先分配足够的内存(通过它自己的实现或通过封装std::string并在其上调用reserve() 。 如果您在代码中看到此调用,那么请注意地雷。 如果你写这个电话,那就是你的设计是可疑的信号。 It's a good question. I'm g ...
  • 您的类已经有一个operator=接受一个String作为输入,一个非explicit构造函数接受一个const char*作为输入。 所以, a = "hello"将使用temp对象调用隐式转换,类似于: String a; a.operator=(String("hello")); 真正的问题是你的operator=正在泄漏内存,并没有正确分配新的内存。 在重新分配之前,你没有释放m_pString ,并且你没有为strlen()和strcpy()需要的null终止符分配足够的内存。 String& ...
  • capacity是字符串当前可以容纳的最大字符数,而不必增加。 size是字符串中实际存在的字符数。 他们分离概念的原因是分配内存通常效率低下,因此您尝试通过获取比实际需要的内存更少的内存来分配内存。 (许多数据结构使用“加倍”方法,如果它们的容量达到N并且需要更多空间,则它们将分配2*N空间,以避免不久后再次重新分配。) 当您使用字符串并且需要更多空间时, capacity会自动增加。 您也可以使用reserve功能手动增加它。 capacity is the maximum number of char ...
  • 如果您只想编写普通的人类可读字符串数据,则不应使用未格式化的I / O函数( read()和write() )。 通常,只有在需要读取和写入紧凑二进制数据时才使用这些函数,这对于初学者来说可能是不必要的。 您可以编写普通的文本行: std::string text = "This is some test data."; { std::ofstream file("data.txt"); file << text << '\n'; } 然后用getline()读回来: { std: ...
  • 原因与向量扩展算法的本质有关。 初始化向量时,应用的额外容量数为0.在第i次需要扩展时,向量将其包含复制到新向量,其容量比当前大小加倍。 这种方法使得大小改变数组的整体思想非常有效,因为在摊销时间(意味着N次操作的平均时间),我们得到O(1)插入复杂度。 你可以看到,在我们向第一个向量添加一个整数后,我们得到的容量为6. http://coliru.stacked-crooked.com/a/f084820652f025b8 The reason is related to the very essence ...
  • java代码中的字符是UNICODE吗? 如果是这样,单个char不足以存储UNICODE字符,比例为4:1 。 最后一个字符(+1)是空终止符。 因此,您需要4个字节,即4个char ,在C ++端存储单个Java字符,C ++中以char表示的字符串以空值终止(最后一个字符必须为'\0' ),因此20*4+1 。 Are the characters in the java code UNICODE? If so, a single char isn't enough to store a UNICOD ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)