本文整理汇总了Java中org.apache.lucene.analysis.path.PathHierarchyTokenizer类的典型用法代码示例。如果您正苦于以下问题:Java PathHierarchyTokenizer类的具体用法?Java PathHierarchyTokenizer怎么用?Java PathHierarchyTokenizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathHierarchyTokenizer类属于org.apache.lucene.analysis.path包,在下文中一共展示了PathHierarchyTokenizer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PathHierarchyTokenizerFactory
import org.apache.lucene.analysis.path.PathHierarchyTokenizer; //导入依赖的package包/类
public PathHierarchyTokenizerFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(indexSettings, name, settings);
bufferSize = settings.getAsInt("buffer_size", 1024);
String delimiter = settings.get("delimiter");
if (delimiter == null) {
this.delimiter = PathHierarchyTokenizer.DEFAULT_DELIMITER;
} else if (delimiter.length() > 1) {
throw new IllegalArgumentException("delimiter can only be a one char value");
} else {
this.delimiter = delimiter.charAt(0);
}
String replacement = settings.get("replacement");
if (replacement == null) {
this.replacement = this.delimiter;
} else if (replacement.length() > 1) {
throw new IllegalArgumentException("replacement can only be a one char value");
} else {
this.replacement = replacement.charAt(0);
}
this.skip = settings.getAsInt("skip", PathHierarchyTokenizer.DEFAULT_SKIP);
this.reverse =
settings.getAsBooleanLenientForPreEs6Indices(indexSettings.getIndexVersionCreated(), "reverse", false, deprecationLogger);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:PathHierarchyTokenizerFactory.java
示例2: PathHierarchyTokenizerFactory
import org.apache.lucene.analysis.path.PathHierarchyTokenizer; //导入依赖的package包/类
@Inject
public PathHierarchyTokenizerFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
super(index, indexSettingsService.getSettings(), name, settings);
bufferSize = settings.getAsInt("buffer_size", 1024);
String delimiter = settings.get("delimiter");
if (delimiter == null) {
this.delimiter = PathHierarchyTokenizer.DEFAULT_DELIMITER;
} else if (delimiter.length() > 1) {
throw new IllegalArgumentException("delimiter can only be a one char value");
} else {
this.delimiter = delimiter.charAt(0);
}
String replacement = settings.get("replacement");
if (replacement == null) {
this.replacement = this.delimiter;
} else if (replacement.length() > 1) {
throw new IllegalArgumentException("replacement can only be a one char value");
} else {
this.replacement = replacement.charAt(0);
}
this.skip = settings.getAsInt("skip", PathHierarchyTokenizer.DEFAULT_SKIP);
this.reverse = settings.getAsBoolean("reverse", false);
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:PathHierarchyTokenizerFactory.java
示例3: create
import org.apache.lucene.analysis.path.PathHierarchyTokenizer; //导入依赖的package包/类
@Override
public Tokenizer create() {
if (reverse) {
return new ReversePathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
}
return new PathHierarchyTokenizer(bufferSize, delimiter, replacement, skip);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:PathHierarchyTokenizerFactory.java
示例4: getPathTokens
import org.apache.lucene.analysis.path.PathHierarchyTokenizer; //导入依赖的package包/类
private List<Token> getPathTokens(String url, String partStringRaw, String partString) throws IOException {
int start = getStartIndex(url, partStringRaw);
if (!tokenizePath) {
int end = getEndIndex(start, partStringRaw);
return Collections.singletonList(new Token(partString, URLPart.PATH, start, end));
}
return tokenize(URLPart.PATH, addReader(new PathHierarchyTokenizer('/', '/'), new StringReader(partString)), start);
}
开发者ID:jlinn,项目名称:elasticsearch-analysis-url,代码行数:9,代码来源:URLTokenizer.java
示例5: create
import org.apache.lucene.analysis.path.PathHierarchyTokenizer; //导入依赖的package包/类
@Override
public Tokenizer create(Reader input) {
if( reverse ) {
return new ReversePathHierarchyTokenizer(input, delimiter, replacement, skip);
}
return new PathHierarchyTokenizer(input, delimiter, replacement, skip);
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:8,代码来源:PathHierarchyTokenizerFactory.java
示例6: init
import org.apache.lucene.analysis.path.PathHierarchyTokenizer; //导入依赖的package包/类
/**
* Require a configured pattern
*/
@Override
public void init(Map<String,String> args){
super.init( args );
String v = args.get( "delimiter" );
if( v != null ){
if( v.length() != 1 ){
throw new IllegalArgumentException("delimiter should be a char. \"" + v + "\" is invalid");
}
else{
delimiter = v.charAt(0);
}
}
else{
delimiter = PathHierarchyTokenizer.DEFAULT_DELIMITER;
}
v = args.get( "replace" );
if( v != null ){
if( v.length() != 1 ){
throw new IllegalArgumentException("replace should be a char. \"" + v + "\" is invalid");
}
else{
replacement = v.charAt(0);
}
}
else{
replacement = delimiter;
}
v = args.get( "reverse" );
if( v != null ){
reverse = "true".equals( v );
}
v = args.get( "skip" );
if( v != null ){
skip = Integer.parseInt( v );
}
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:44,代码来源:PathHierarchyTokenizerFactory.java
注:本文中的org.apache.lucene.analysis.path.PathHierarchyTokenizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论