缺少PyLucene org.apache.lucene.benchmark

时间:2015-07-05 21:04:55

标签: java python lucene pylucene

我刚刚在Ubuntu 14.04上通过Makefile安装了PyLucene 4.9(也尝试了4.8),一切运行正常,只是我缺少org.apache.lucene.benchmark中的模块。

PyLucene文档说明了它:PyLucene Documentation

但是,当我打开ipython并通过org.apache.lucene标记#34;"我只从自动填充中获得这些结果:

python

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

1 个答案:

答案 0 :(得分:0)

Okay, i was able to figure it out by myself. If you want to use the benchmark module, you have to edit the Makefile in the following ways:

1.Find the JARS section,the items look like this:

JARS+=$(ANALYZERS_JAR)          # many language analyzers 

remove the comment before JARS+=$(SPATIAL), now add the line:

JARS+=$(BENCHMARK_JAR)          # benchmark module`

2.Find the JAR-path section where the items look like

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

add the following line to this section:

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

3.Find the ANT-section where the text looks like:

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

append the following text at the end of the section:

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

4.Right below, to the JCCFLAGS?= add --classpath "./lucene-java-4.9.0/lucene/spatial/lib/spatial4j-0.4.$

5.At the GENERATE section, add the following excludes(if you need these Modules to work with in Python you might have to download extra .jar files and add them to the jcc classpath, i didn't need them for my task":

--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 \  

Everything should be working now