mmseg4j 1.9.1 + Solr 4.7.0 报错

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.
 
解决办法:
http://lucene.apache.org/core/4_6_0/changes/Changes.html#v4.6.0.changes_in_backwards_compatibility_policy

LUCENE-5235: Sub classes of Tokenizer have to call super.reset() when implementing reset(). Otherwise the consumer will get an IllegalStateException because the Reader is not correctly assigned. It is important to never change the "input" field on Tokenizer without using setReader(). The "input" field must not be used outside reset(), incrementToken(), or end() - especially not in the constructor. 

MMSegTokenizer.java

public void reset() throws IOException {
		//lucene 4.0
		//org.apache.lucene.analysis.Tokenizer.setReader(Reader)
		//setReader 自动被调用, input 自动被设置。
		super.reset();   //加这一句
		mmSeg.reset(input);
	}

可以自己下载工程修改后,放到mmseg4j-analysis-1.9.1.jar中
自己的工程需要引入lucene-core-4.7.0.jar和mmseg4j-solr-1.9.1.jar和mmseg4j-core-1.9.1.jar

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值