當前位置: 首頁>>代碼示例>>Java>>正文


Java Assisted類代碼示例

本文整理匯總了Java中org.elasticsearch.common.inject.assistedinject.Assisted的典型用法代碼示例。如果您正苦於以下問題:Java Assisted類的具體用法?Java Assisted怎麽用?Java Assisted使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Assisted類屬於org.elasticsearch.common.inject.assistedinject包,在下文中一共展示了Assisted類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PathHierarchyTokenizerFactory

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的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

示例2: HunspellTokenFilterFactory

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public HunspellTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings, HunspellService hunspellService)  {
    super(index, indexSettingsService.getSettings(), name, settings);

    String locale = settings.get("locale", settings.get("language", settings.get("lang", null)));
    if (locale == null) {
        throw new IllegalArgumentException("missing [locale | language | lang] configuration for hunspell token filter");
    }

    dictionary = hunspellService.getDictionary(locale);
    if (dictionary == null) {
        throw new IllegalArgumentException(String.format(Locale.ROOT, "Unknown hunspell dictionary for locale [%s]", locale));
    }

    dedup = settings.getAsBoolean("dedup", true);
    longestOnly = settings.getAsBoolean("longest_only", false);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:18,代碼來源:HunspellTokenFilterFactory.java

示例3: PatternAnalyzerProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public PatternAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    Version esVersion = Version.indexCreated(indexSettingsService.getSettings());
    final CharArraySet defaultStopwords;
    if (esVersion.onOrAfter(Version.V_1_0_0_RC1)) {
        defaultStopwords = CharArraySet.EMPTY_SET;
    } else {
        defaultStopwords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
    }
    boolean lowercase = settings.getAsBoolean("lowercase", true);
    CharArraySet stopWords = Analysis.parseStopWords(env, settings, defaultStopwords);

    String sPattern = settings.get("pattern", "\\W+" /*PatternAnalyzer.NON_WORD_PATTERN*/);
    if (sPattern == null) {
        throw new IllegalArgumentException("Analyzer [" + name + "] of type pattern must have a `pattern` set");
    }
    Pattern pattern = Regex.compile(sPattern, settings.get("flags"));

    analyzer = new PatternAnalyzer(pattern, lowercase, stopWords);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:23,代碼來源:PatternAnalyzerProvider.java

示例4: CJKBigramFilterFactory

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public CJKBigramFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    outputUnigrams = settings.getAsBoolean("output_unigrams", false);
    final String[] asArray = settings.getAsArray("ignored_scripts");
    Set<String> scripts = new HashSet<>(Arrays.asList("han", "hiragana", "katakana", "hangul"));
    if (asArray != null) {
        scripts.removeAll(Arrays.asList(asArray));
    }
    int flags = 0;
    for (String script : scripts) {
        if ("han".equals(script)) {
            flags |= CJKBigramFilter.HAN;
        } else if ("hiragana".equals(script)) {
            flags |= CJKBigramFilter.HIRAGANA;
        } else if ("katakana".equals(script)) {
            flags |= CJKBigramFilter.KATAKANA;
        } else if ("hangul".equals(script)) {
            flags |= CJKBigramFilter.HANGUL;
        }
    }
    this.flags = flags;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:24,代碼來源:CJKBigramFilterFactory.java

示例5: DelimitedPayloadTokenFilterFactory

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public DelimitedPayloadTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name,
        @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    String delimiterConf = settings.get(DELIMITER);
    if (delimiterConf != null) {
        delimiter = delimiterConf.charAt(0);
    } else {
        delimiter = DEFAULT_DELIMITER;
    }
        
    if (settings.get(ENCODING) != null) {
        if (settings.get(ENCODING).equals("float")) {
            encoder = new FloatEncoder();
        } else if (settings.get(ENCODING).equals("int")) {
            encoder = new IntegerEncoder();
        } else if (settings.get(ENCODING).equals("identity")) {
            encoder = new IdentityEncoder();
        } 
    } else {
        encoder = DEFAULT_ENCODER;
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:24,代碼來源:DelimitedPayloadTokenFilterFactory.java

示例6: BM25SimilarityProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public BM25SimilarityProvider(@Assisted String name, @Assisted Settings settings) {
    super(name);
    float k1 = settings.getAsFloat("k1", 1.2f);
    float b = settings.getAsFloat("b", 0.75f);
    boolean discountOverlaps = settings.getAsBoolean("discount_overlaps", true);

    this.similarity = new BM25Similarity(k1, b);
    this.similarity.setDiscountOverlaps(discountOverlaps);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:BM25SimilarityProvider.java

示例7: DFISimilarityProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public DFISimilarityProvider(@Assisted String name, @Assisted Settings settings) {
    super(name);
    boolean discountOverlaps = settings.getAsBoolean("discount_overlaps", true);
    Independence measure = parseIndependence(settings);
    this.similarity = new DFISimilarity(measure);
    this.similarity.setDiscountOverlaps(discountOverlaps);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:DFISimilarityProvider.java

示例8: IBSimilarityProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public IBSimilarityProvider(@Assisted String name, @Assisted Settings settings) {
    super(name);
    Distribution distribution = parseDistribution(settings);
    Lambda lambda = parseLambda(settings);
    Normalization normalization = parseNormalization(settings);
    this.similarity = new IBSimilarity(distribution, lambda, normalization);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:IBSimilarityProvider.java

示例9: RomanianAnalyzerProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public RomanianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new RomanianAnalyzer(Analysis.parseStopWords(env, settings, RomanianAnalyzer.getDefaultStopSet()),
                                    Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:8,代碼來源:RomanianAnalyzerProvider.java

示例10: LengthTokenFilterFactory

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public LengthTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    min = settings.getAsInt("min", 0);
    max = settings.getAsInt("max", Integer.MAX_VALUE);
    if (version.onOrAfter(Version.LUCENE_4_4) && settings.get(ENABLE_POS_INC_KEY) != null) {
        throw new IllegalArgumentException(ENABLE_POS_INC_KEY + " is not supported anymore. Please fix your analysis chain or use"
                + " an older compatibility version (<=4.3) but beware that it might cause highlighting bugs.");
    }
    enablePositionIncrements = version.onOrAfter(Version.LUCENE_4_4) ? true : settings.getAsBoolean(ENABLE_POS_INC_KEY, true);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:12,代碼來源:LengthTokenFilterFactory.java

示例11: BasqueAnalyzerProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public BasqueAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new BasqueAnalyzer(Analysis.parseStopWords(env, settings, BasqueAnalyzer.getDefaultStopSet()),
                                  Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:8,代碼來源:BasqueAnalyzerProvider.java

示例12: StandardHtmlStripAnalyzerProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public StandardHtmlStripAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env,  @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    this.esVersion = Version.indexCreated(indexSettingsService.getSettings());
    final CharArraySet defaultStopwords;
    if (esVersion.onOrAfter(Version.V_1_0_0_RC1)) {
        defaultStopwords = CharArraySet.EMPTY_SET;
    } else {
        defaultStopwords = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
    }
    CharArraySet stopWords = Analysis.parseStopWords(env, settings, defaultStopwords);
    analyzer = new StandardHtmlStripAnalyzer(stopWords);
    analyzer.setVersion(version);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:15,代碼來源:StandardHtmlStripAnalyzerProvider.java

示例13: IndonesianAnalyzerProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public IndonesianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new IndonesianAnalyzer(Analysis.parseStopWords(env, settings, IndonesianAnalyzer.getDefaultStopSet()),
                                      Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:8,代碼來源:IndonesianAnalyzerProvider.java

示例14: ArabicAnalyzerProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public ArabicAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    arabicAnalyzer = new ArabicAnalyzer(Analysis.parseStopWords(env, settings, ArabicAnalyzer.getDefaultStopSet()),
                                        Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    arabicAnalyzer.setVersion(version);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:8,代碼來源:ArabicAnalyzerProvider.java

示例15: SnowballAnalyzerProvider

import org.elasticsearch.common.inject.assistedinject.Assisted; //導入依賴的package包/類
@Inject
public SnowballAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    String language = settings.get("language", settings.get("name", "English"));
    CharArraySet defaultStopwords = defaultLanguageStopwords.containsKey(language) ? defaultLanguageStopwords.get(language) : CharArraySet.EMPTY_SET;
    CharArraySet stopWords = Analysis.parseStopWords(env, settings, defaultStopwords);

    analyzer = new SnowballAnalyzer(language, stopWords);
    analyzer.setVersion(version);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:12,代碼來源:SnowballAnalyzerProvider.java


注:本文中的org.elasticsearch.common.inject.assistedinject.Assisted類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。