@Override public void init(Map<String, String> args) { super.init(args); }
@Override public void init(Map<String, String> args) { super.init(args); min=Integer.parseInt(args.get(MIN_KEY)); max=Integer.parseInt(args.get(MAX_KEY)); } public LengthFilter create(TokenStream input) {
@Override public void init(Map<String, String> args) { super.init(args); final String cfgLanguage = args.get("language"); if(cfgLanguage!=null) language = cfgLanguage; try { stemClass = Class.forName("org.tartarus.snowball.ext." + language + "Stemmer"); } catch (ClassNotFoundException e) { throw new RuntimeException("Can't find class for stemmer language " + language, e); } }
public void init(Map<String, String> args) { super.init(args); payload = Float.parseFloat(args.get("payload")); typeMatch = args.get("typeMatch"); } public NumericPayloadTokenFilter create(TokenStream input) {
/** Initialize the n-gram min and max sizes and the side from which one should start tokenizing. */ @Override public void init(Map<String, String> args) { super.init(args); String maxArg = args.get("maxGramSize"); maxGramSize = (maxArg != null ? Integer.parseInt(maxArg) : NGramTokenFilter.DEFAULT_MAX_NGRAM_SIZE); String minArg = args.get("minGramSize"); minGramSize = (minArg != null ? Integer.parseInt(minArg) : NGramTokenFilter.DEFAULT_MIN_NGRAM_SIZE); }
@Override public void init(Map<String, String> args) { super.init(args); inject = getBoolean(INJECT, true); if (args.get(MAX_CODE_LENGTH) != null) { maxCodeLength = Integer.parseInt(args.get(MAX_CODE_LENGTH)); } }
public void init(Map<String, String> args) { super.init(args); charset = RussianCommon.getCharset(args.get("charset")); }
@Override public void init(Map<String, String> args) { super.init(args); charset = RussianCommon.getCharset(args.get("charset")); }
public void init(Map<String, String> args) { super.init(args); positionIncrement = getInt("positionIncrement", 0); }
public void init(Map<String,String> args) { super.init(args); enablePositionIncrements = getBoolean("enablePositionIncrements", false); }
@Override public void init(Map<String,String> args) { super.init( args ); String v = args.get( "updateOffsets" ); if( v != null ) { try { updateOffsets = Boolean.valueOf( v ); } catch( Exception ex ) { throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Error reading updateOffsets value. Must be true or false.", ex ); } } }
@Override public void init(Map<String, String> args) { super.init(args); String maxArg = args.get("maxGramSize"); maxGramSize = (maxArg != null ? Integer.parseInt(maxArg) : EdgeNGramTokenFilter.DEFAULT_MAX_GRAM_SIZE); String minArg = args.get("minGramSize"); minGramSize = (minArg != null ? Integer.parseInt(minArg) : EdgeNGramTokenFilter.DEFAULT_MIN_GRAM_SIZE); side = args.get("side"); if (side == null) { side = EdgeNGramTokenFilter.Side.FRONT.getLabel(); } }
@Override public void init(Map<String, String> args) { super.init(args); String charsetName = args.get("charset"); if (null != charsetName) { charset = CHARSETS.get(charsetName); if (charset.equals(GreekCharsets.UnicodeGreek)) logger.warn("Specifying UnicodeGreek is no longer required (default). " + "Use of the charset parameter will cause an error in Solr 1.5"); else logger.warn("Support for this custom encoding is deprecated. " + "Use of the charset parameter will cause an error in Solr 1.5"); } else { charset = GreekCharsets.UnicodeGreek; /* default to unicode */ } if (null == charset) { throw new SolrException(ErrorCode.SERVER_ERROR, "Don't understand charset: " + charsetName); } } public GreekLowerCaseFilter create(TokenStream in) {
@Override public void init(Map<String, String> args) { super.init(args); try { p = Pattern.compile(args.get("pattern")); } catch (PatternSyntaxException e) { throw new RuntimeException ("Configuration Error: 'pattern' can not be parsed in " + this.getClass().getName(), e); } replacement = args.get("replacement"); String r = args.get("replace"); if (null != r) { if (r.equals("all")) { all = true; } else { if (r.equals("first")) { all = false; } else { throw new RuntimeException ("Configuration Error: 'replace' must be 'first' or 'all' in " + this.getClass().getName()); } } } } public PatternReplaceFilter create(TokenStream input) {
public void init(Map<String, String> args) { super.init(args); try { factory = new NameFinderFactory(args); } catch (IOException e) { throw (RuntimeException) new RuntimeException().initCause(e); } }
public void init(Map<String, String> args) { super.init(args); maxShingleSize = getInt("maxShingleSize", ShingleFilter.DEFAULT_MAX_SHINGLE_SIZE); outputUnigrams = getBoolean("outputUnigrams", true); } public ShingleFilter create(TokenStream input) {
@Override public void init(Map<String,String> args) { super.init( args ); inject = getBoolean(INJECT, true); String name = args.get( ENCODER ); if( name == null ) { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Missing required parameter: "+ENCODER +" ["+registry.keySet()+"]" ); } Class<? extends Encoder> clazz = registry.get(name.toUpperCase()); if( clazz == null ) { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Unknown encoder: "+name +" ["+registry.keySet()+"]" ); } try { encoder = clazz.newInstance(); // Try to set the maxCodeLength String v = args.get( "maxCodeLength" ); if( v != null ) { Method setter = encoder.getClass().getMethod( "setMaxCodeLen", int.class ); setter.invoke( encoder, Integer.parseInt( v ) ); } } catch (Exception e) { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error initializing: "+name + "/"+clazz, e , false); } }
public void init(Map<String, String> args) { super.init(args); dictFile = args.get("dictionary"); if (null == dictFile) { throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Missing required parameter: dictionary"); } minWordSize= getInt("minWordSize",CompoundWordTokenFilterBase.DEFAULT_MIN_WORD_SIZE); minSubwordSize= getInt("minSubwordSize",CompoundWordTokenFilterBase.DEFAULT_MIN_SUBWORD_SIZE); maxSubwordSize= getInt("maxSubwordSize",CompoundWordTokenFilterBase.DEFAULT_MAX_SUBWORD_SIZE); onlyLongestMatch = getBoolean("onlyLongestMatch",true); } public void inform(ResourceLoader loader) {
@Override public void init(Map<String, String> args) { super.init(args); withOriginal = getBoolean("withOriginal", true); maxPosAsterisk = getInt("maxPosAsterisk", 2); maxPosQuestion = getInt("maxPosQuestion", 1); minTrailing = getInt("minTrailing", 2); maxFractionAsterisk = getFloat("maxFractionAsterisk", 0.0f); }
@Override public void init(Map<String, String> args) { super.init(args); generateWordParts = getInt("generateWordParts", 1); generateNumberParts = getInt("generateNumberParts", 1); catenateWords = getInt("catenateWords", 0); catenateNumbers = getInt("catenateNumbers", 0); catenateAll = getInt("catenateAll", 0); splitOnCaseChange = getInt("splitOnCaseChange", 1); splitOnNumerics = getInt("splitOnNumerics", 1); preserveOriginal = getInt("preserveOriginal", 0); stemEnglishPossessive = getInt("stemEnglishPossessive", 1); }