缺少 PyLucene org.apache.lucene.benchmark
PyLucene org.apache.lucene.benchmark is missing
我刚刚在 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.Find JARS 部分,项目如下所示:
JARS+=$(ANALYZERS_JAR) # many language analyzers
删除 JARS+=$(SPATIAL)
之前的注释,现在添加行:
JARS+=$(BENCHMARK_JAR) # benchmark module`
2.Find 项目看起来像
的 JAR 路径部分
LUCENE_JAR=$(LUCENE)/build/core/lucene-core-$(LUCENE_VER).jar
将以下行添加到此部分:
BENCHMARK_JAR=$(LUCENE)/build/benchmark/lucene-benchmark-$(LUCENE_VER).jar
3.Find 文本看起来像的 ANT 部分:
$(LUCENE_JAR): $(LUCENE)
cd $(LUCENE); $(ANT) -Dversion=$(LUCENE_VER)
在该部分末尾附加以下文本:
$(BENCHMARK_JAR): $(LUCENE_JAR)
cd $(LUCENE)/benchmark; $(ANT) -Dversion=$(LUCENE_VER)
4.Right 下面,到 JCCFLAGS?= 添加 --classpath "./lucene-java-4.9.0/lucene/spatial/lib/spatial4j-0.4.$
5.At 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 \
现在一切正常
我刚刚在 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.Find JARS 部分,项目如下所示:
JARS+=$(ANALYZERS_JAR) # many language analyzers
删除 JARS+=$(SPATIAL)
之前的注释,现在添加行:
JARS+=$(BENCHMARK_JAR) # benchmark module`
2.Find 项目看起来像
的 JAR 路径部分LUCENE_JAR=$(LUCENE)/build/core/lucene-core-$(LUCENE_VER).jar
将以下行添加到此部分:
BENCHMARK_JAR=$(LUCENE)/build/benchmark/lucene-benchmark-$(LUCENE_VER).jar
3.Find 文本看起来像的 ANT 部分:
$(LUCENE_JAR): $(LUCENE)
cd $(LUCENE); $(ANT) -Dversion=$(LUCENE_VER)
在该部分末尾附加以下文本:
$(BENCHMARK_JAR): $(LUCENE_JAR)
cd $(LUCENE)/benchmark; $(ANT) -Dversion=$(LUCENE_VER)
4.Right 下面,到 JCCFLAGS?= 添加 --classpath "./lucene-java-4.9.0/lucene/spatial/lib/spatial4j-0.4.$
5.At 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 \
现在一切正常