我刚刚在 Ubuntu 14.04 上通过 Makefile 安装了 PyLucene 4.9(并且还尝试了 4.8),一切都运行良好,除了我缺少 org.apache.lucene.benchmark 中的模块。
PyLucene 文档说它就在那里:PyLucene Documentation
但是当我打开 ipython 并通过“from org.apache.lucene”进行切换时。我只从自动完成中得到这些结果:
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
所以我假设我的安装出了问题,但我无法弄清楚。有没有人遇到过这种问题并且可以提供帮助?
最佳答案
好吧,我自己解决了。 如果要使用基准测试模块,则必须按以下方式编辑Makefile:
1.找到 JARS 部分,项目如下所示:
JARS+=$(ANALYZERS_JAR) # many language analyzers
删除JARS+=$(SPATIAL)
之前的注释,现在添加以下行:
JARS+=$(BENCHMARK_JAR) # benchmark module`
2.找到项目看起来像的 JAR 路径部分
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.在生成部分,添加以下排除内容(如果您需要这些模块在 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 \
现在一切都应该正常工作
关于java - PyLucene org.apache.lucene.benchmark 丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31234990/