List of usage examples for org.apache.lucene.analysis.path PathHierarchyTokenizer DEFAULT_DELIMITER
char DEFAULT_DELIMITER
To view the source code for org.apache.lucene.analysis.path PathHierarchyTokenizer DEFAULT_DELIMITER.
Click Source Link
From source file:org.apache.solr.analysis.PathHierarchyTokenizerFactory.java
License:Apache License
/** * Require a configured pattern/*from w w w. j a va 2 s . com*/ */ @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); } }
From source file:org.elasticsearch.analysis.common.PathHierarchyTokenizerFactory.java
License:Apache License
PathHierarchyTokenizerFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {/*from w ww. j ava 2s .c o m*/ super(indexSettings, 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 must 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 must 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); }
From source file:org.elasticsearch.index.analysis.PathHierarchyTokenizerFactory.java
License:Apache License
@Inject public PathHierarchyTokenizerFactory(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {//from w ww.j a v a 2 s . c o m super(index, 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 ElasticsearchIllegalArgumentException("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 ElasticsearchIllegalArgumentException("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); }