Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjie committed Nov 8, 2009
1 parent a0e66cc commit f33f05e
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/org/wltea/analyzer/solr/IKTokenizerFactory14.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
*
*/
package org.wltea.analyzer.solr;

import java.io.Reader;
import java.util.Map;

import org.apache.lucene.analysis.Tokenizer;
import org.apache.solr.analysis.BaseTokenizerFactory;
import org.wltea.analyzer.lucene.IKTokenizer;

/**
* 实现Solr1.4分词器接口
* 基于IKTokenizer的实现
*
* @author 李良杰
*
*/
public final class IKTokenizerFactory14 extends BaseTokenizerFactory{

private boolean isMaxWordLength = false;

/**
* IK分词器Solr TokenizerFactory接口实现类
* 默认最细粒度切分算法
*/
public IKTokenizerFactory14(){
}

/*
* (non-Javadoc)
* @see org.apache.solr.analysis.BaseTokenizerFactory#init(java.util.Map)
*/
public void init(Map<String,String> args){
String _arg = args.get("isMaxWordLength");
isMaxWordLength = Boolean.parseBoolean(_arg);
}

/*
* (non-Javadoc)
* @see org.apache.solr.analysis.TokenizerFactory#create(java.io.Reader)
*/
public Tokenizer create(Reader reader) {
return new IKTokenizer(reader , isMaxWordLength());
}

public void setMaxWordLength(boolean isMaxWordLength) {
this.isMaxWordLength = isMaxWordLength;
}

public boolean isMaxWordLength() {
return isMaxWordLength;
}

}

0 comments on commit f33f05e

Please sign in to comment.