码迷,mamicode.com
首页 > 其他好文 > 详细

mmseg4j 1.9.1 + Solr 4.7.2报错

时间:2014-09-25 18:29:37      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:Lucene   style   http   color   io   os   java   ar   for   

mmseg4j 1.9.1 + Solr 4.7.2报错

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);
	}

可以自己下载zip工程修改后 mvn package,放到mmseg4j-analysis-1.9.1.jar中
 

mmseg4j 1.9.1 + Solr 4.7.2报错

标签:Lucene   style   http   color   io   os   java   ar   for   

原文地址:http://www.cnblogs.com/muzhongjiang/p/3993300.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!