[英]jython and lucene failed to get the standard module to create the StandardAnalyzer
我正在嘗試在jython27中使用Apache lucene。 為此,我設置了CLASSPATH:
% echo $CLASSPATH
/opt/lucene-4.5.0/core/lucene-core-4.5.0.jar:/opt/lucene-4.5.0/queryparser/lucene-queryparser-4.5.0.jar:analysis/common/lucene-analyzers-common-4.5.0.jar:/opt/lucene-4.5.0/demo/lucene-demo-4.5.0.jar
我找到了一些我嘗試遵循的示例 。 但是,它無法導入標准模塊以獲取StandardAnalyzer()。
>>> from org.apache.lucene import analysis
>>> dir(analysis)
['Analyzer', 'AnalyzerWrapper', 'CachingTokenFilter', 'CharFilter', 'NumericTokenStream', 'Token', 'TokenFilter', 'TokenStream', 'TokenStreamToAutomaton', 'Tokenizer', '__name__', 'tokenattributes']
>>> from org.apache.lucene.analysis import standard
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name standard
有人知道出了什么問題嗎?
啊,該死。我設置的CLASSPATH錯誤。 這有效:
% export CLASSPATH=$CLASSPATH:/opt/lucene-4.5.0/analysis/common/lucene-analyzers-common-4.5.0.jar
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.