![](/img/trans.png)
[英]Get NullPointerException from calling org.apache.lucene.benchmark.byTask.feeds.TrecGov2Parser.parse
[英]PyLucene org.apache.lucene.benchmark is missing
我剛剛在Ubuntu 14.04上通過Makefile安裝了PyLucene 4.9(並嘗試了4.8),除了我在org.apache.lucene.benchmark中缺少模塊之外,其他所有程序都運行良好。
PyLucene文檔說它在那里: PyLucene文檔
但是當我打開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-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 \
現在一切都應該正常工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.