Java Code Examples for org.elasticsearch.index.settings.IndexSettingsService

The following examples show how to use org.elasticsearch.index.settings.IndexSettingsService. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: Elasticsearch   Author: baidu   File: PathHierarchyTokenizerFactory.java    License: Apache License 2.0 7 votes vote down vote up
@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);
}
 
Example #2
Source Project: Elasticsearch   Author: baidu   File: IndexQueryParserService.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public IndexQueryParserService(Index index, IndexSettingsService indexSettingsService,
                               IndicesQueriesRegistry indicesQueriesRegistry,
                               ScriptService scriptService, AnalysisService analysisService,
                               MapperService mapperService, IndexCache indexCache, IndexFieldDataService fieldDataService,
                               BitsetFilterCache bitsetFilterCache,
                               @Nullable SimilarityService similarityService) {
    super(index, indexSettingsService.getSettings());
    this.indexSettingsService = indexSettingsService;
    this.scriptService = scriptService;
    this.analysisService = analysisService;
    this.mapperService = mapperService;
    this.similarityService = similarityService;
    this.indexCache = indexCache;
    this.fieldDataService = fieldDataService;
    this.bitsetFilterCache = bitsetFilterCache;

    Settings indexSettings = indexSettingsService.getSettings();
    this.defaultField = indexSettings.get(DEFAULT_FIELD, AllFieldMapper.NAME);
    this.queryStringLenient = indexSettings.getAsBoolean(QUERY_STRING_LENIENT, false);
    this.parseFieldMatcher = new ParseFieldMatcher(indexSettings);
    this.defaultAllowUnmappedFields = indexSettings.getAsBoolean(ALLOW_UNMAPPED, true);
    this.indicesQueriesRegistry = indicesQueriesRegistry;
}
 
Example #3
Source Project: elasticsearch-analysis-hanlp   Author: donbeave   File: HanLpTokenizerTokenizerFactory.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public HanLpTokenizerTokenizerFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    indexMode = settings.getAsBoolean(INDEX_MODE, indexMode);
    nameRecognize = settings.getAsBoolean(NAME_RECOGNIZE, nameRecognize);
    translatedNameRecognize = settings.getAsBoolean(TRANSLATED_NAME_RECOGNIZE, translatedNameRecognize);
    japaneseNameRecognize = settings.getAsBoolean(JAPANESE_NAME_RECOGNIZE, japaneseNameRecognize);
    placeRecognize = settings.getAsBoolean(PLACE_RECOGNIZE, placeRecognize);
    organizationRecognize = settings.getAsBoolean(ORGANIZATION_RECOGNIZE, organizationRecognize);
    useCustomDictionary = settings.getAsBoolean(USE_CUSTOM_DICTIONARY, useCustomDictionary); // enableCustomDictionary
    speechTagging = settings.getAsBoolean(SPEECH_TAGGING, speechTagging); // PorterStemming
    offset = settings.getAsBoolean(OFFSET, offset);
    numberQuantifierRecognize = settings.getAsBoolean(NUMBER_QUANTIFIER_RECOGNIZE, numberQuantifierRecognize);
    threads = settings.getAsInt(THREADS, threads); // if more than 1, it means use multi-threading
}
 
Example #4
Source Project: Elasticsearch   Author: baidu   File: HunspellTokenFilterFactory.java    License: Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #5
Source Project: elasticsearch-analysis-hanlp   Author: donbeave   File: HanLpAnalyzerProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public HanLpAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    boolean indexMode = settings.getAsBoolean(INDEX_MODE, false);
    boolean nameRecognize = settings.getAsBoolean(NAME_RECOGNIZE, true);
    boolean translatedNameRecognize = settings.getAsBoolean(TRANSLATED_NAME_RECOGNIZE, true);
    boolean japaneseNameRecognize = settings.getAsBoolean(JAPANESE_NAME_RECOGNIZE, false);
    boolean placeRecognize = settings.getAsBoolean(PLACE_RECOGNIZE, false);
    boolean organizationRecognize = settings.getAsBoolean(ORGANIZATION_RECOGNIZE, false);
    boolean useCustomDictionary = settings.getAsBoolean(USE_CUSTOM_DICTIONARY, true); // enableCustomDictionary
    boolean speechTagging = settings.getAsBoolean(SPEECH_TAGGING, false); // PorterStemming
    boolean offset = settings.getAsBoolean(OFFSET, false);
    boolean numberQuantifierRecognize = settings.getAsBoolean(NUMBER_QUANTIFIER_RECOGNIZE, false);
    int threads = settings.getAsInt(THREADS, 1); // if more than 1, it means use multi-threading

    analyzer = new HanLPAnalyzer(indexMode, nameRecognize, translatedNameRecognize, japaneseNameRecognize,
                                 placeRecognize, organizationRecognize, useCustomDictionary, speechTagging, offset,
                                 numberQuantifierRecognize, threads, null);
}
 
Example #6
Source Project: Elasticsearch   Author: baidu   File: IndexStore.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
public IndexStore(Index index, IndexSettingsService settingsService, IndicesStore indicesStore) {
    super(index, settingsService.getSettings());
    Settings indexSettings = settingsService.getSettings();
    this.indicesStore = indicesStore;

    this.rateLimitingType = indexSettings.get(INDEX_STORE_THROTTLE_TYPE, "none");
    if (rateLimitingType.equalsIgnoreCase("node")) {
        nodeRateLimiting = true;
    } else {
        nodeRateLimiting = false;
        rateLimiting.setType(rateLimitingType);
    }
    this.rateLimitingThrottle = indexSettings.getAsBytesSize(INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC, new ByteSizeValue(0));
    rateLimiting.setMaxRate(rateLimitingThrottle);

    logger.debug("using index.store.throttle.type [{}], with index.store.throttle.max_bytes_per_sec [{}]", rateLimitingType, rateLimitingThrottle);
    this.settingsService = settingsService;
    this.settingsService.addListener(applySettings);
}
 
Example #7
Source Project: Elasticsearch   Author: baidu   File: DelimitedPayloadTokenFilterFactory.java    License: Apache License 2.0 6 votes vote down vote up
@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;
    }
}
 
Example #8
Source Project: Elasticsearch   Author: baidu   File: DLBasedIndexShard.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public DLBasedIndexShard(ShardId shardId,
        IndexSettingsService indexSettingsService,
        IndicesLifecycle indicesLifecycle, Store store,
        StoreRecoveryService storeRecoveryService, ThreadPool threadPool,
        MapperService mapperService,
        IndexQueryParserService queryParserService, IndexCache indexCache,
        IndexAliasesService indexAliasesService,
        IndicesQueryCache indicesQueryCache,
        ShardPercolateService shardPercolateService,
        CodecService codecService,
        ShardTermVectorsService termVectorsService,
        IndexFieldDataService indexFieldDataService,
        IndexService indexService, IndicesWarmer warmer,
        SnapshotDeletionPolicy deletionPolicy,
        SimilarityService similarityService, EngineFactory factory,
        ClusterService clusterService, ShardPath path, BigArrays bigArrays,
        IndexSearcherWrappingService wrappingService,
        IndexingMemoryController indexingMemoryController,
        TransportGetOrChangePrimaryShardLeaseAction checkLeaseAction,
        TransportIndexShardStatsAction indexShardStatsAction,
        SearchService shardSearchService) {
    super(shardId, indexSettingsService, indicesLifecycle, store,
            storeRecoveryService, threadPool, mapperService, queryParserService,
            indexCache, indexAliasesService, indicesQueryCache,
            shardPercolateService, codecService, termVectorsService,
            indexFieldDataService, indexService, warmer, deletionPolicy,
            similarityService, factory, clusterService, path, bigArrays,
            wrappingService, indexingMemoryController, shardSearchService);
    this.localNodeId = clusterService.state().nodes().localNodeId();
    this.checkLeaseAction = checkLeaseAction;
    this.indexShardStatsAction = indexShardStatsAction;
}
 
Example #9
Source Project: Elasticsearch   Author: baidu   File: BlobShard.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public BlobShard(ShardId shardId,
                 IndexSettingsService indexSettingsService,
                 BlobEnvironment blobEnvironment,
                 IndexShard indexShard) {
    super(shardId, indexSettingsService.getSettings());
    this.indexShard = indexShard;
    File blobDir = blobDir(blobEnvironment);
    logger.info("creating BlobContainer at {}", blobDir);
    this.blobContainer = new BlobContainer(blobDir);
}
 
Example #10
Source Project: Elasticsearch   Author: baidu   File: BlobIndex.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public BlobIndex(Index index, IndexSettingsService indexSettingsService,
          OperationRouting operationRouting, ClusterService clusterService) {
    super(index, indexSettingsService.getSettings());
    this.operationRouting = operationRouting;
    this.clusterService = clusterService;
}
 
Example #11
Source Project: Elasticsearch   Author: baidu   File: NorwegianAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public NorwegianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new NorwegianAnalyzer(Analysis.parseStopWords(env, settings, NorwegianAnalyzer.getDefaultStopSet()),
                                     Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example #12
Source Project: Elasticsearch   Author: baidu   File: TruncateTokenFilterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public TruncateTokenFilterFactory(Index index, IndexSettingsService indexSettingsService,
                                  @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    this.length = settings.getAsInt("length", -1);
    if (length <= 0) {
        throw new IllegalArgumentException("length parameter must be provided");
    }
}
 
Example #13
Source Project: Elasticsearch   Author: baidu   File: IndexFieldDataService.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public IndexFieldDataService(Index index, IndexSettingsService indexSettingsService, IndicesFieldDataCache indicesFieldDataCache,
                             CircuitBreakerService circuitBreakerService, MapperService mapperService) {
    super(index, indexSettingsService.getSettings());
    this.indicesFieldDataCache = indicesFieldDataCache;
    this.circuitBreakerService = circuitBreakerService;
    this.mapperService = mapperService;
}
 
Example #14
Source Project: Elasticsearch   Author: baidu   File: IndexService.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public IndexService(Injector injector, Index index, NodeEnvironment nodeEnv,
                    AnalysisService analysisService, MapperService mapperService, IndexQueryParserService queryParserService,
                    SimilarityService similarityService, IndexAliasesService aliasesService, IndexCache indexCache,
                    IndexSettingsService settingsService,
                    IndexFieldDataService indexFieldData, BitsetFilterCache bitSetFilterCache, IndicesService indicesServices) {

    super(index, settingsService.getSettings());
    this.injector = injector;
    this.analysisService = analysisService;
    this.mapperService = mapperService;
    this.queryParserService = queryParserService;
    this.similarityService = similarityService;
    this.aliasesService = aliasesService;
    this.indexCache = indexCache;
    this.indexFieldData = indexFieldData;
    this.settingsService = settingsService;
    this.bitsetFilterCache = bitSetFilterCache;

    this.pluginsService = injector.getInstance(PluginsService.class);
    this.indicesServices = indicesServices;
    this.indicesLifecycle = (InternalIndicesLifecycle) injector.getInstance(IndicesLifecycle.class);

    // inject workarounds for cyclic dep
    indexFieldData.setListener(new FieldDataCacheListener(this));
    bitSetFilterCache.setListener(new BitsetCacheListener(this));
    this.nodeEnv = nodeEnv;
}
 
Example #15
Source Project: Elasticsearch   Author: baidu   File: BulgarianAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public BulgarianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new BulgarianAnalyzer(Analysis.parseStopWords(env, settings, BulgarianAnalyzer.getDefaultStopSet()),
                                     Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example #16
Source Project: Elasticsearch   Author: baidu   File: KeepTypesFilterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public KeepTypesFilterFactory(Index index, IndexSettingsService indexSettingsService,
                             Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    final String[] arrayKeepTypes = settings.getAsArray(KEEP_TYPES_KEY, null);
    if ((arrayKeepTypes == null)) {
        throw new IllegalArgumentException("keep_types requires `" + KEEP_TYPES_KEY + "` to be configured");
    }

    this.keepTypes = new HashSet<>(Arrays.asList(arrayKeepTypes));
}
 
Example #17
Source Project: Elasticsearch   Author: baidu   File: LengthTokenFilterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #18
Source Project: Elasticsearch   Author: baidu   File: BasqueAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #19
Source Project: Elasticsearch   Author: baidu   File: StandardHtmlStripAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #20
Source Project: Elasticsearch   Author: baidu   File: IndonesianAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #21
Source Project: Elasticsearch   Author: baidu   File: KeywordMarkerTokenFilterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public KeywordMarkerTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    boolean ignoreCase = settings.getAsBoolean("ignore_case", false);
    Set<?> rules = Analysis.getWordSet(env, settings, "keywords");
    if (rules == null) {
        throw new IllegalArgumentException("keyword filter requires either `keywords` or `keywords_path` to be configured");
    }
    keywordLookup = new CharArraySet(rules, ignoreCase);
}
 
Example #22
Source Project: Elasticsearch   Author: baidu   File: DutchAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public DutchAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new DutchAnalyzer(Analysis.parseStopWords(env, settings, DutchAnalyzer.getDefaultStopSet()),
                                 Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example #23
Source Project: Elasticsearch   Author: baidu   File: PatternReplaceCharFilterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public PatternReplaceCharFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name);

    if (!Strings.hasLength(settings.get("pattern"))) {
        throw new IllegalArgumentException("pattern is missing for [" + name + "] char filter of type 'pattern_replace'");
    }
    pattern = Pattern.compile(settings.get("pattern"));
    replacement = settings.get("replacement", ""); // when not set or set to "", use "".
}
 
Example #24
Source Project: Elasticsearch   Author: baidu   File: StopAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public StopAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    CharArraySet stopWords = Analysis.parseStopWords(env, settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
    this.stopAnalyzer = new StopAnalyzer(stopWords);
    this.stopAnalyzer.setVersion(version);
}
 
Example #25
Source Project: Elasticsearch   Author: baidu   File: SwedishAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public SwedishAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new SwedishAnalyzer(Analysis.parseStopWords(env, settings, SwedishAnalyzer.getDefaultStopSet()),
                                   Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example #26
Source Project: Elasticsearch   Author: baidu   File: StopTokenFilterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public StopTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    this.ignoreCase = settings.getAsBoolean("ignore_case", false);
    this.removeTrailing = settings.getAsBoolean("remove_trailing", true);
    this.stopWords = Analysis.parseStopWords(env, settings, StopAnalyzer.ENGLISH_STOP_WORDS_SET, ignoreCase);
    if (version.onOrAfter(Version.LUCENE_4_4) && settings.get("enable_position_increments") != null) {
        throw new IllegalArgumentException("enable_position_increments is not supported anymore as of Lucene 4.4 as it can create broken token streams."
                + " Please fix your analysis chain or use an older compatibility version (<= 4.3).");
    }
    this.enablePositionIncrements = settings.getAsBoolean("enable_position_increments", true);
}
 
Example #27
Source Project: Elasticsearch   Author: baidu   File: SpanishAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public SpanishAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new SpanishAnalyzer(Analysis.parseStopWords(env, settings, SpanishAnalyzer.getDefaultStopSet()),
                                   Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example #28
Source Project: elasticsearch-analysis-bosonnlp   Author: bosondata   File: BosonNLPAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public BosonNLPAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {

    super(index, indexSettingsService.getSettings(), name, settings);
    this.TAG_URL = settings.get("API_URL", "").toString();
    this.BOSONNLP_API_TOKEN = settings.get("API_TOKEN", "").toString();
    this.spaceMode = Integer.parseInt(settings.get("space_mode", "0"));
    this.oovLevel = Integer.parseInt(settings.get("oov_level", "3"));
    this.t2s = Integer.parseInt(settings.get("t2s", "0"));
    this.specialCharConv = Integer.parseInt(settings.get("spechial_char_conv", "0"));

    this.analyzer = new BosonNLPAnalyzer(TAG_URL, BOSONNLP_API_TOKEN, spaceMode, oovLevel, t2s, specialCharConv);

}
 
Example #29
Source Project: Elasticsearch   Author: baidu   File: MappingCharFilterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public MappingCharFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name);

    List<String> rules = Analysis.getWordList(env, settings, "mappings");
    if (rules == null) {
        throw new IllegalArgumentException("mapping requires either `mappings` or `mappings_path` to be configured");
    }

    NormalizeCharMap.Builder normMapBuilder = new NormalizeCharMap.Builder();
    parseRules(rules, normMapBuilder);
    normMap = normMapBuilder.build();
}
 
Example #30
Source Project: Elasticsearch   Author: baidu   File: LithuanianAnalyzerProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public LithuanianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new LithuanianAnalyzer(Analysis.parseStopWords(env, settings, LithuanianAnalyzer.getDefaultStopSet()),
                                  Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}