Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lucene Neo4J 1.9.1的替代索引提供程序_Lucene_Neo4j - Fatal编程技术网

Lucene Neo4J 1.9.1的替代索引提供程序

Lucene Neo4J 1.9.1的替代索引提供程序,lucene,neo4j,Lucene,Neo4j,我正在我的应用程序中使用Lucene 4,不想更改此设置。我试图将捆绑Lucene 3.5的Neo4J集成为一个IndexProvider实现,即Neo4J-Lucene索引 不幸的是,neo4j-lucene索引不起作用,并且由于排除了这种依赖关系,应用程序在启动时会无限期地挂起。我尝试过neo4j-lucene4-index,但它似乎没有得到很好的维护,需要进行重大更新才能使用neo4j 1.9.1。这些变化远远超出了我对Neo4J内部的理解 然而,我可以看到IndexProviders是可

我正在我的应用程序中使用Lucene 4,不想更改此设置。我试图将捆绑Lucene 3.5的Neo4J集成为一个IndexProvider实现,即Neo4J-Lucene索引

不幸的是,neo4j-lucene索引不起作用,并且由于排除了这种依赖关系,应用程序在启动时会无限期地挂起。我尝试过neo4j-lucene4-index,但它似乎没有得到很好的维护,需要进行重大更新才能使用neo4j 1.9.1。这些变化远远超出了我对Neo4J内部的理解

然而,我可以看到IndexProviders是可插拔的,所以我希望有一个现有的替代Lucene的方法——尽管目前我找不到。有人能为我指出正确的方向吗

看起来很奇怪,Lucene 4已经退出这么长时间了,Neo4J不支持它。我错过什么了吗

目前,我的POM在Neo4J配置中看起来是这样的:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-neo4j</artifactId>
    <version>2.2.1.RELEASE</version>
    <exclusions>
        <exclusion>
        <artifactId>neo4j</artifactId>
        <groupId>org.neo4j</groupId>
        </exclusion>
        <exclusion>
        <artifactId>neo4j-cypher</artifactId>
        <groupId>org.neo4j</groupId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-kernel</artifactId>
    <version>1.9.1</version>
    <exclusion>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-lucene-index</artifactId>
    </exclusion>
</dependency>

<dependency>
    <groupId>org.neo4j.app</groupId>
    <artifactId>neo4j-server</artifactId>
    <version>1.9.1</version>
    <exclusions>
        <exclusion>
        <artifactId>neo4j</artifactId>
        <groupId>org.neo4j</groupId>
        </exclusion>
        <exclusion>
        <artifactId>neo4j-cypher</artifactId>
        <groupId>org.neo4j</groupId>
        </exclusion>
        <exclusion>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-lucene-index</artifactId>
        </exclusion>
    </exclusions>
</dependency>

    <!-- A temporary dependency until Neo4J builds in support for Lucene 4. 
    Looks like they're planning to incorporate this project anyway This project 
    is available on GitHub, and needs to be built with: mvn license:format mvn 
    install to install into your local repo. 
        <dependency>
            <groupId>com.keatext</groupId>
            <artifactId>neo4j-lucene4-index</artifactId>
            <version>1.9.M01-SNAPSHOT</version>
        </dependency>-->

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>5.0.1.Final</version>
</dependency>

org.springframework.data
spring-data-neo4j
2.2.1.发布
neo4j
org.neo4j
neo4j-cypher
org.neo4j
org.neo4j
neo4j核
1.9.1
org.neo4j
neo4j-lucene指数
org.neo4j.app
neo4j服务器
1.9.1
neo4j
org.neo4j
neo4j-cypher
org.neo4j
org.neo4j
neo4j-lucene指数
org.hibernate
休眠验证器
5.0.1.最终版本

从1.8->1.9开始,在内部进行了一些更改。简而言之,索引提供程序必须通过META-INF/services注册KernelExtensionFactory,请参阅


这个KernelExtensionFactory是一个入口点,只需在上检查基于Lucene 3的实现

如果您不在乎Neo4j使用什么索引,并且您使用Maven管理依赖项,那么可以使用重命名Neo4j的Lucene依赖项,这样它就不会与Lucene新版本上的其他依赖项冲突


在我的例子中,这需要将依赖Neo4j的代码移动到一个单独的Maven项目中,因为Shade一次作用于整个项目/jar。因此,如果您可以将冲突的Lucene依赖项放到不同的项目中,这将非常有效。

不久前,我还面临着这个问题:我正在进行原型设计,我非常喜欢Neo4j的嵌入式模式。但是,一旦我决定使用Lucene 4,我就被不兼容性问题绊倒了

OSGi

正如这里所建议的:-一个可能的解决方案是使用Neo4j和Lucene 4,并将其包装成不同的束。每个包都有单独的类加载器——因此Neo4j将在运行时使用Lucene 3中的类,但您仍然可以出于自己的目的使用Lucene 4

但是,就我在原型设计方面的工作而言,我不想因为两个组件的不兼容性而把时间花在我的OSGi平台项目的改编上

Maven Shade插件

所以,我在的帮助下解决了这个问题

Maven Shade插件提供了将所有依赖项合并到单个“胖”JAR(也称为“优步JAR”)中的能力

因此,您可以生成“uber Neo4j依赖项”,并在项目中使用它,而不是“真正的”Neo4j依赖项

但是还有一个重要的时刻:Lucene 3和Lucene 4具有相同的包结构,许多类仍然具有相同的名称。因此,这可能会导致类加载冲突

为了解决这个问题,Maven Shade插件提供了在生成“uber JAR”期间重新定位类的功能:

您可以指定包名,在打包过程中-Shade插件会将类从指定包及其子包移动到其他包,并重写受影响的字节码

因此,在为Neo4j编写“uber JAR”的过程中,您可以配置Shade插件,将Lucene 3的类移动到其他包中,例如:

org.apache.lucene.->shadded_3_6_2.org.apache.lucene.

(幸运的是,Neo4j在Lucene应用中似乎没有使用反射)

因此,您可以使用以下
pom.xml


4.0.0
我的哈克

我很惊讶没有内置的默认实现。谢谢你的链接,我会查出来的。我现在只想要一些非常简单的东西来证明我们的应用程序的概念。Neo4j将索引作为一个实现细节,不依赖于任何Lucene4独有的功能。我们做了一些测试,Lucene4在我们的用例中比3.6慢得多,这就是为什么它没有被优先考虑的原因。谢谢Michael,这很有趣。对于我的用例,我希望将其与现有MongoDB数据配对,以便遍历相关数据。目前我们正在使用Lucene 4,但我想我应该看看我的内部搜索需求降级到3.6的影响。我有一些性能测试脚本,我可以在测试前后进行比较