Closed GoogleCodeExporter closed 8 years ago
这个是因为Lucene 4.0
beta里面Tokenizer的API改动的缘故,从之前的reset变成了现在的se
t,只需要把MMSegTokenizer类中reset方法的名字改成set去override掉�
��类的方法即可。
Original comment by EddieDu...@gmail.com
on 3 Sep 2012 at 9:41
楼上方法试了不行啊。
Original comment by dota.rep...@gmail.com
on 3 Sep 2012 at 2:47
不好意思,我没说清楚。
4.0Beta里,reset被改成了setReader,有两个类需要改动,一个是MM
SegTokenizerFactory(里面含有关于setReader的调用),另外一个是M
MSegTokenizer(需要override掉父类setReader的方法)。
Original comment by EddieDu...@gmail.com
on 4 Sep 2012 at 2:17
MMSegTokenizer.java文件改动:
//public void reset(Reader input) throws IOException {
public void setReader(Reader input) throws IOException {
//super.reset(input);
mmSeg.reset(input);
}
MMSegTokenizerFactory.java文件改动:
try {
//tokenizer.reset(input);
tokenizer.setReader(input);
} catch (IOException e) {
tokenizer = newTokenizer(input);
log.info("MMSegTokenizer.reset i/o error by:"+e.getMessage());
}
是这样吗。
Original comment by dota.rep...@gmail.com
on 4 Sep 2012 at 4:45
//super.reset(input);
这个应该改为super.setReader(input);吧
Original comment by dota.rep...@gmail.com
on 4 Sep 2012 at 4:58
[deleted comment]
[deleted comment]
改后编译出错
[javac] ~/tmp/mmseg4j/src/com/chenlb/mmseg4j/analysis/MMSegTokenizer.java:34: error: cannot find symbol
[javac] super.setReader(input);
[javac] ^
[javac] symbol: method setReader(Reader)
[javac] 1 error
Original comment by dota.rep...@gmail.com
on 4 Sep 2012 at 6:02
MMSegTokenizer.java文件改动:
//public void reset(Reader input) throws IOException {
public void setReader(Reader input) throws IOException {
super.setReader(input);
mmSeg.reset(input);
}
另外,你有引入Lucene 4.0
Beta吗?如果有,不应该编译不过啊!
Original comment by EddieDu...@gmail.com
on 4 Sep 2012 at 6:21
引入是不是就是该ivy.xml:
<dependencies>^M
<!-- solr/lucene -->^M
<dependency org="org.apache.lucene" name="lucene-core" rev="4.0.0-BETA" conf="compile->master(*)"/>^M
<dependency org="org.apache.lucene" name="lucene-analyzers-common" rev="4.0.0-BETA" conf="compile->master(*)"/>^M
<dependency org="org.apache.lucene" name="lucene-queryparser" rev="4.0.0-BETA" conf="compile->master(*)"/>^M
<dependency org="org.apache.solr" name="solr-core" rev="4.0.0-BETA" conf="compile->master(*)"/>^M
<dependency org="org.apache.solr" name="solr-solrj" rev="4.0.0-BETA" conf="compile->master(*)"/>^M
^M
</dependencies>^M
Original comment by dota.rep...@gmail.com
on 4 Sep 2012 at 6:35
[deleted comment]
[deleted comment]
终于搞定了。
要吧lib下得ALPHA版本的jar文件删掉。
thanks.
Original comment by dota.rep...@gmail.com
on 4 Sep 2012 at 6:57
这个应该让作者编译一个版本才是啊
Original comment by wjia...@gmail.com
on 4 Sep 2012 at 8:26
我現在正在配置solr4正式版的時候也遇到這樣的問題
有點不知道該怎麼去build
不知道是否可以提供一下更改後編譯好的檔案呢? 謝謝
Original comment by ay771...@gmail.com
on 23 Oct 2012 at 3:16
照著上面的改成setReader會說無法override
用原本的reset的話再solr那邊測試的時候會出現 Error occured
while iterating over tokenstream
請問該怎麼改?
[javac] Compiling 1 source file to /opt/mmseg4j/build/classes/java
[javac] /opt/mmseg4j/src/com/chenlb/mmseg4j/analysis/MMSegTokenizer.java:32: setReader(java.io.Reader) in com.chenlb.mmseg4j.analysis.MMSegTokenizer cannot override setReader(java.io.Reader) in org.apache.lucene.analysis.Tokenizer; overridden method is final
[javac] public void setReader(Reader input) throws IOException {
[javac] ^
[javac] 1 error
Original comment by ay771...@gmail.com
on 23 Oct 2012 at 6:12
请将你的MMSegTokenizer类的 incrementToken
方法标注成final。否则在debug模式下会抛异常。
Original comment by EddieDu...@gmail.com
on 25 Oct 2012 at 2:27
Comment 3 by EddieDu...@gmail.com, Sep 3, 2012
不好意思,我没说清楚。
4.0Beta里,reset被改成了setReader,有两个类需要改动,一个是MM
SegTokenizerFactory(里面含有关于setReader的调用),另外一个是M
MSegTokenizer(需要override掉父类setReader的方法)。
另外一个是MMSegTokenizer(需要override掉父类setReader的方法)
现在的正式版里,setReader已经是final,不能被override了,请作�
��抽点时间重新发布个版本吧
Original comment by x03570227
on 14 Nov 2012 at 8:46
我也遇到这个问题了,还以为是lucene4和solr4不兼容呢,
狂google了一圈. 还好找到了这个帖子. 麻烦作者更新下发布包.
Original comment by kch...@valueclickbrands.com
on 29 Nov 2012 at 3:35
谢谢eddie和dota的讨论, 我把solr,
lucene都改称4.0.0正式版编译了一下. 自己测试能用了.
付上编译后的jar包和大家分享.
Original comment by kch...@valueclickbrands.com
on 29 Nov 2012 at 4:16
Attachments:
下载kevin的包还是有问题
Original comment by liuzihen...@gmail.com
on 25 Dec 2012 at 9:43
solr4.6+mmseg4j1.9集成时报错
ERROR org.apache.solr.core.SolrCore – java.lang.IllegalStateException:
TokenStream contract violation: reset()/close() call missing, reset() called
multiple times, or subclass does not call super.reset(). Please see Javadocs of
TokenStream class for more information about the correct consuming workflow.
想问一下你们在修改代码然后重新编译项目。那么源代码是��
�哪儿下载的啊?!我怎么没找着源代码在哪儿?!
Original comment by qjayg...@gmail.com
on 18 Feb 2014 at 8:39
使用 2.0.0
参考 https://github.com/chenlb/mmseg4j-solr
Original comment by chenlb2...@gmail.com
on 19 May 2014 at 12:08
Original issue reported on code.google.com by
wjia...@gmail.com
on 15 Aug 2012 at 4:23