如何重建Neo4j Lucene索引? - Neo4j.rb
我在 Rails 3.1 上使用 Neo4j.rb gem (1.2.2) 在 Neo4j (1.4) 上运行
我遇到了 Neo4j 索引损坏的问题,我无法再运行数据库,如 这个 我删除了db/index dir 并且它有效。但是我需要再次重建索引。
我在文档中找不到有关如何重建索引的任何地方,有人可以帮忙吗?
多谢!
I am running on Neo4j (1.4) using Neo4j.rb gem (1.2.2) on Rails 3.1
I bumped into problem where neo4j index was corrupted that I cant run the database anymore, as mentioned in several forums like this I deleted the db/index dir and it worked. However I need to rebuild the index again.
I could not find anywhere in the docs on how to rebuild the index, could anybody please help?
Thanks alot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该进入数据库目录并删除
,然后遍历节点和边的孔集,更新每个节点的属性。
/普尔邦
You should go into your database directory and remove
and later on traverse the hole set of nodes and edges, updating the properties of each node.
/purbon
我的问题是类似的 - 升级到 neo4j 1.5(从 1.4)后,我的索引被损坏。
我的案例:
我有两个索引:
__types__
:用于索引持久对象的类型(由spring-data-neo4j 2.0.0.RC1 提供)
User
:用于索引用户名字段,因此我可以在它们之后进行查找这导致了一个主要问题,我可以通过它们的 id 找到所有节点,但无法在用户名之后进行查找,或列出某种类型的所有对象。
修复(我将提供 java 代码,但其他语言的想法也是相同的):
希望这可以帮助您或某人!
My problem was similar - after upgrading to neo4j 1.5 (from 1.4) my indexes got corrupted.
My case:
I had two indexes:
__types__
: for indexing the type of persisted objects (provided byspring-data-neo4j 2.0.0.RC1
)User
: for indexing the username field, so I could do lookups after themThis resulted in a major problem, where I could find all the nodes by their id, but could not do lookups after username, or list all objects of a certain type.
The fix ( I will provide java code, but the idea would be the same in other languages too):
Hope this helps you or someone out!
感谢所有试图提供帮助的人。就我而言,我通过采取以下步骤成功解决了该问题:
第 1 步按照 Neo4j 的 Michael Hunger(通过邮件列表)的建议,我使用了一个名为 checkindex 的工具来删除损坏的索引条目Lucene 和 Solr 的 Checkindex
第 2 步 删除损坏的文件后指数条目,剩下的问题是构建它们,以便 Lucene 可以再次开始查询它们。这可以简单地使用 Model.addindex(:index_name) 来完成。请注意,此操作需要包装在 Neo4j::Transaction 中。就我而言,我在 Railsconsole 上运行它,但我想您也可以在 Rails 应用程序中对它们进行编码。
示例:
希望这可以帮助遇到同样问题的其他人。
干杯
Thanks to all who tried to help. In my case I have successfully solved the problem by taking the following steps:
Step 1 Following the recommendation from Neo4j's Michael Hunger (via mailing list), I used a tool called checkindex to remove corrupt index entries Lucene and Solr's Checkindex
Step 2 Upon removal of corrupt index entries, the remaining problem is to build them so Lucene can start querying them again. This could simply be done using using Model.addindex(:index_name). Note that this operation needs to be wrapped within a Neo4j::Transaction. In my case I ran it on railsconsole but I suppose you could also code them within the rails app.
Example:
Hope this could help others who face the same problems.
Cheers