2013-10-27 50 views
0

我想在jython27中使用apache lucene。要做到這一點,我設置CLASSPATH:jython和lucene未能獲得標準模塊來創建StandardAnalyzer

% 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 

我發現someexamples,我試圖效仿。但是,它無法導入標準模塊以獲得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 

有人想法出了什麼問題嗎?

回答

0

啊該死的..我設置錯誤的CLASSPATH。此作品:

% export CLASSPATH=$CLASSPATH:/opt/lucene-4.5.0/analysis/common/lucene-analyzers-common-4.5.0.jar