lucene如何与Neo4j配合使用 [英] How lucene works with Neo4j

查看:263
本文介绍了lucene如何与Neo4j配合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Neo4j Solr/Lucene 的新手.我读过我们可以在Neo4j中使用Lucene查询,这是如何工作的?在Neo4j中使用lucene查询有什么用??

I am new to Neo4j and Solr/Lucene. i have read that we can use lucene query in Neo4j how does this works? What is the use of using lucene query in Neo4j.?

我也需要一个建议.我需要编写一个应用程序来搜索和分析数据. which might help me Neo4j Or Solr?

And also i need a suggestion. I need to write an application to search and analyse the data. which might help me Neo4j Or Solr?

推荐答案

Neo4J使用lucene作为其

Neo4J uses lucene as part of its legacy indexing. Right now, Neo4J supports several kinds of indexes, like creating labels on nodes, and indexes on node properties.

但是在neo4j支持这些新功能之前,它主要(并且仍然)使用Lucene进行索引.大多数开发人员会在特定的节点属性上创建lucene索引,以使他们能够使用lucene的查询语法在密码查询中查找节点.

But before neo4j supported those new features, it primarily (and still) used Lucene for indexing. Most developers would create lucene indexes on particular node properties, to enable them to use lucene's query syntax to find nodes within a cypher query.

例如,如果您根据文档创建了索引 ,然后可以在索引中搜索特定的值,例如:

For example, if you created an index according to the documentation, you could then search the index for particular values like this:

IndexHits<Node> hits = actors.get( "name", "Keanu Reeves" );
Node reeves = hits.getSingle();

实际上是在做幕后工作的Lucene.

It's lucene behind the scenes that's actually doing that finding.

在密码中,它可能看起来像这样:

In cypher, it might look like this:

start n=node:node_auto_index('name:M* OR name:N*')
return n;

在这种情况下,您正在搜索具有name属性以"M"或"N"开头的所有节点的特定索引.在单引号表达式的内部,仅根据 lucene查询语法.

In this case, you're searching a particular index for all nodes that have a name property that starts either with an "M" or an "N". What's inside of that single quote expression there is just a query according to the lucene query syntax.

好的,这就是Neo4J使用lucene的方式.在最新版本中,我仅将这些旧索引"用于全文索引,这是Lucene的优势所在.如果我只想快速进行相等性检查(其中name ="Neo"),则可以使用常规neo4j模式索引.

OK, so that's how Neo4J uses lucene. In recent versions, I only use these "legacy indexes" for fulltext indexing, which is where lucene's strength is. If I just want fast equality checks (where name="Neo") then I use regular neo4j schema indexes.

对于Solr,我还没有看到它与neo4j结合使用-也许有人会加入并提供反例,但通常我认为Solr运行在大的lucene索引之上,并且在例如neo4j,就在中间,我不确定运行Solr是否合适.

As for Solr, I haven't seen it used in conjunction with neo4j - maybe someone will jump in and provide a counter-example, but usually I think of Solr as running on top of a big lucene index, and in the case of neo4j, it's kind of in the middle there, and I'm not sure running Solr would be a good fit.

至于您需要编写一个应用程序来搜索和分析数据,我不能给您推荐-Neo4J或Solr可能会有所帮助,这取决于您的应用程序和您想做什么.通常,当您需要表达和搜索图形时,请使用neo4j.需要组织和搜索大量文本文档时,请更多使用Solr.

As for you needing to write an application to search and analyze data, I can't give you a recommendation - either Neo4J or Solr might help, depending on your application and what you want to do. In generalities, use neo4j when you need to express and search graphs. Use Solr more when you need to organize and search large volumes of text documents.

这篇关于lucene如何与Neo4j配合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆