|
@@ -20,8 +20,6 @@
|
|
package org.elasticsearch.index.mapper;
|
|
package org.elasticsearch.index.mapper;
|
|
|
|
|
|
import org.apache.logging.log4j.message.ParameterizedMessage;
|
|
import org.apache.logging.log4j.message.ParameterizedMessage;
|
|
-import org.apache.lucene.analysis.Analyzer;
|
|
|
|
-import org.apache.lucene.analysis.DelegatingAnalyzerWrapper;
|
|
|
|
import org.elasticsearch.Assertions;
|
|
import org.elasticsearch.Assertions;
|
|
import org.elasticsearch.Version;
|
|
import org.elasticsearch.Version;
|
|
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
|
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
|
@@ -108,7 +106,6 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|
private final DocumentMapperParser documentMapperParser;
|
|
private final DocumentMapperParser documentMapperParser;
|
|
private final DocumentParser documentParser;
|
|
private final DocumentParser documentParser;
|
|
private final Version indexVersionCreated;
|
|
private final Version indexVersionCreated;
|
|
- private final MapperAnalyzerWrapper indexAnalyzer;
|
|
|
|
private final MapperRegistry mapperRegistry;
|
|
private final MapperRegistry mapperRegistry;
|
|
private final Supplier<Mapper.TypeParser.ParserContext> parserContextSupplier;
|
|
private final Supplier<Mapper.TypeParser.ParserContext> parserContextSupplier;
|
|
|
|
|
|
@@ -121,7 +118,6 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|
super(indexSettings);
|
|
super(indexSettings);
|
|
this.indexVersionCreated = indexSettings.getIndexVersionCreated();
|
|
this.indexVersionCreated = indexSettings.getIndexVersionCreated();
|
|
this.indexAnalyzers = indexAnalyzers;
|
|
this.indexAnalyzers = indexAnalyzers;
|
|
- this.indexAnalyzer = new MapperAnalyzerWrapper();
|
|
|
|
this.mapperRegistry = mapperRegistry;
|
|
this.mapperRegistry = mapperRegistry;
|
|
Function<DateFormatter, Mapper.TypeParser.ParserContext> parserContextFunction =
|
|
Function<DateFormatter, Mapper.TypeParser.ParserContext> parserContextFunction =
|
|
dateFormatter -> new Mapper.TypeParser.ParserContext(similarityService::getSimilarity, mapperRegistry.getMapperParsers()::get,
|
|
dateFormatter -> new Mapper.TypeParser.ParserContext(similarityService::getSimilarity, mapperRegistry.getMapperParsers()::get,
|
|
@@ -441,10 +437,6 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|
return this.mapper == null ? null : this.mapper.mappers().objectMappers().get(name);
|
|
return this.mapper == null ? null : this.mapper.mappers().objectMappers().get(name);
|
|
}
|
|
}
|
|
|
|
|
|
- public Analyzer indexAnalyzer() {
|
|
|
|
- return this.indexAnalyzer;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Return the index-time analyzer associated with a particular field
|
|
* Return the index-time analyzer associated with a particular field
|
|
* @param field the field name
|
|
* @param field the field name
|
|
@@ -495,20 +487,6 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|
return mapperRegistry.isMetadataField(indexVersionCreated, field);
|
|
return mapperRegistry.isMetadataField(indexVersionCreated, field);
|
|
}
|
|
}
|
|
|
|
|
|
- /** An analyzer wrapper that can lookup fields within the index mappings */
|
|
|
|
- final class MapperAnalyzerWrapper extends DelegatingAnalyzerWrapper {
|
|
|
|
-
|
|
|
|
- MapperAnalyzerWrapper() {
|
|
|
|
- super(Analyzer.PER_FIELD_REUSE_STRATEGY);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- protected Analyzer getWrappedAnalyzer(String fieldName) {
|
|
|
|
- return mapper.mappers().indexAnalyzer();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public synchronized List<String> reloadSearchAnalyzers(AnalysisRegistry registry) throws IOException {
|
|
public synchronized List<String> reloadSearchAnalyzers(AnalysisRegistry registry) throws IOException {
|
|
logger.info("reloading search analyzers");
|
|
logger.info("reloading search analyzers");
|
|
// refresh indexAnalyzers and search analyzers
|
|
// refresh indexAnalyzers and search analyzers
|