本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}