【问题标题】:PyLucene org.apache.lucene.benchmark is missingPyLucene org.apache.lucene.benchmark 缺失
【发布时间】:2015-09-22 23:00:57
【问题描述】:

我刚刚在 Ubuntu 14.04 上通过 Makefile 安装了 PyLucene 4.9(也尝试使用 4.8),一切都运行良好,除了我缺少 org.apache.lucene.benchmark 中的模块。

PyLucene 文档说它在那里:PyLucene Documentation

但是当我通过“来自 org.apache.lucene”打开 ipython 和选项卡时。我只从自动完成中得到这些结果:

In [3]: from org.apache.lucene.
org.apache.lucene.analysis     org.apache.lucene.queries
org.apache.lucene.codecs       org.apache.lucene.queryparser
org.apache.lucene.collation    org.apache.lucene.sandbox
org.apache.lucene.document     org.apache.lucene.search
org.apache.lucene.expressions  org.apache.lucene.store
org.apache.lucene.facet        org.apache.lucene.util
org.apache.lucene.index 

所以我假设我的安装出了点问题,但我无法弄清楚。有没有人遇到过这种问题并可以提供帮助?

【问题讨论】:

    标签: java python lucene pylucene


    【解决方案1】:

    好的,我自己想通了。 如果你想使用 benchmark 模块,你必须通过以下方式编辑 Makefile:

    1.找到 JARS 部分,项目如下所示:

    JARS+=$(ANALYZERS_JAR)          # many language analyzers 
    

    删除JARS+=$(SPATIAL)之前的注释,现在添加行:

    JARS+=$(BENCHMARK_JAR)          # benchmark module`
    

    2.找到项目看起来像的JAR-path部分

    LUCENE_JAR=$(LUCENE)/build/core/lucene-core-$(LUCENE_VER).jar  
    

    在此部分添加以下行:

    BENCHMARK_JAR=$(LUCENE)/build/benchmark/lucene-benchmark-$(LUCENE_VER).jar
    

    3.找到文本看起来像的ANT部分:

    $(LUCENE_JAR): $(LUCENE)
            cd $(LUCENE); $(ANT) -Dversion=$(LUCENE_VER)
    

    在该部分的末尾附加以下文本:

    $(BENCHMARK_JAR): $(LUCENE_JAR)
            cd $(LUCENE)/benchmark; $(ANT) -Dversion=$(LUCENE_VER)  
    

    4.右下角的JCCFLAGS?=添加--classpath "./lucene-java-4.9.0/lucene/spatial/lib/spatial4j-0.4.$

    5.在 GENERATE 部分,添加以下排除项(如果您需要这些模块在 Python 中使用,您可能需要下载额外的 .jar 文件并将它们添加到 jcc 类路径中,我不需要它们任务”:

    --exclude org.apache.lucene.benchmark.byTask.utils.StreamUtils \
    --exclude org.apache.lucene.benchmark.byTask.utils.LineDocSourceTest \
    --exclude org.apache.lucene.benchmark.byTask.utils.WriteLineDocTaskTest \
    --exclude org.apache.lucene.benchmark.byTask.feeds.LongToEnglishQueryMaker \ 
    --exclude org.apache.lucene.benchmark.byTask.feeds.LongToEnglishContentSource \  
    

    现在应该一切正常

    【讨论】:

    • 我遇到了类似的问题,因为 PyLucene 8.6.1 中缺少 org.apache.lucene.analysis.opennlp,我使用的是 Ubuntu 18.04。这是我问的question。你能给我一些关于我需要做什么的指示吗?
    猜你喜欢
    • 2015-05-14
    • 1970-01-01
    • 2011-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多