Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MapperBuilderContext;
import org.elasticsearch.index.mapper.SourceValueFetcher;
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.xcontent.XContentBuilder;
Expand Down Expand Up @@ -114,7 +113,7 @@ public static final class RankFeatureFieldType extends MappedFieldType {
private final Float nullValue;

public RankFeatureFieldType(String name, Map<String, String> meta, boolean positiveScoreImpact, Float nullValue) {
super(name, true, false, false, TextSearchInfo.NONE, meta);
super(name, true, false, false, meta);
this.positiveScoreImpact = positiveScoreImpact;
this.nullValue = nullValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.apache.lucene.search.Query;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MetadataFieldMapper;
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;

Expand All @@ -38,7 +37,7 @@ public static final class RankFeatureMetaFieldType extends MappedFieldType {

// made visible for tests
RankFeatureMetaFieldType() {
super(NAME, false, false, false, TextSearchInfo.NONE, Collections.emptyMap());
super(NAME, false, false, false, Collections.emptyMap());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MapperBuilderContext;
import org.elasticsearch.index.mapper.SourceValueFetcher;
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.xcontent.XContentParser.Token;
Expand Down Expand Up @@ -80,7 +79,7 @@ public static final class RankFeaturesFieldType extends MappedFieldType {
private final boolean positiveScoreImpact;

public RankFeaturesFieldType(String name, Map<String, String> meta, boolean positiveScoreImpact) {
super(name, true, false, false, TextSearchInfo.SIMPLE_MATCH_ONLY, meta);
super(name, true, false, false, meta);
this.positiveScoreImpact = positiveScoreImpact;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public ScaledFloatFieldType(
boolean coerce,
boolean isSyntheticSource
) {
super(name, indexed, stored, hasDocValues, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, indexed, stored, hasDocValues, meta);
this.scalingFactor = scalingFactor;
this.nullValue = nullValue;
this.metricType = metricType;
Expand Down Expand Up @@ -320,6 +320,11 @@ public boolean isSearchable() {
return isIndexed() || hasDocValues();
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

@Override
public Query termQuery(Object value, SearchExecutionContext context) {
failIfNotIndexedNorDocValuesFallback(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.elasticsearch.index.mapper.RangeFieldMapper;
import org.elasticsearch.index.mapper.RangeType;
import org.elasticsearch.index.mapper.SourceValueFetcher;
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.FilteredSearchExecutionContext;
import org.elasticsearch.index.query.QueryBuilder;
Expand Down Expand Up @@ -240,7 +239,7 @@ static class PercolatorFieldType extends MappedFieldType {
boolean mapUnmappedFieldsAsText;

private PercolatorFieldType(String name, Map<String, String> meta) {
super(name, false, false, false, TextSearchInfo.NONE, meta);
super(name, false, false, false, meta);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MapperBuilderContext;
import org.elasticsearch.index.mapper.SourceValueFetcher;
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.script.field.murmur3.Murmur3DocValueField;
Expand Down Expand Up @@ -69,7 +68,7 @@ public Murmur3FieldMapper build(MapperBuilderContext context) {
public static class Murmur3FieldType extends MappedFieldType {

private Murmur3FieldType(String name, boolean isStored, Map<String, String> meta) {
super(name, false, isStored, true, TextSearchInfo.NONE, meta);
super(name, false, isStored, true, meta);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions server/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
requires org.apache.lucene.queryparser;
requires org.apache.lucene.sandbox;
requires org.apache.lucene.suggest;
requires org.elasticsearch.server;

exports org.elasticsearch;
exports org.elasticsearch.action;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected AbstractGeometryFieldType(
T nullValue,
Map<String, String> meta
) {
super(name, indexed, stored, hasDocValues, TextSearchInfo.NONE, meta);
super(name, indexed, stored, hasDocValues, meta);
this.nullValue = nullValue;
this.geometryParser = geometryParser;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected AbstractScriptFieldType(
Map<String, String> meta,
boolean isParsedFromSource
) {
super(name, false, false, false, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, false, false, false, meta);
this.factory = factory;
this.script = Objects.requireNonNull(script);
this.isResultDeterministic = isResultDeterministic;
Expand All @@ -79,6 +79,11 @@ public final boolean isAggregatable() {
return true;
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

@Override
public final Query rangeQuery(
Object lowerTerm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public BinaryFieldMapper build(MapperBuilderContext context) {

public static final class BinaryFieldType extends MappedFieldType {
private BinaryFieldType(String name, boolean isStored, boolean hasDocValues, Map<String, String> meta) {
super(name, false, isStored, hasDocValues, TextSearchInfo.NONE, meta);
super(name, false, isStored, hasDocValues, meta);
}

public BinaryFieldType(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class ConstantFieldType extends MappedFieldType {

@SuppressWarnings("this-escape")
public ConstantFieldType(String name, Map<String, String> meta) {
super(name, true, false, true, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, true, false, true, meta);
assert isSearchable();
}

Expand All @@ -47,6 +47,11 @@ public final boolean isAggregatable() {
return true;
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

/**
* Return whether the constant value of this field matches the provided {@code pattern}
* as documented in {@link Regex#simpleMatch}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static final class TimestampFieldType extends MappedFieldType {
static final TimestampFieldType INSTANCE = new TimestampFieldType();

private TimestampFieldType() {
super(NAME, false, false, false, TextSearchInfo.NONE, Map.of());
super(NAME, false, false, false, Map.of());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public DateFieldType(
FieldValues<Long> scriptValues,
Map<String, String> meta
) {
super(name, isIndexed, isStored, hasDocValues, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, isIndexed, isStored, hasDocValues, meta);
this.dateTimeFormatter = dateTimeFormatter;
this.dateMathParser = dateTimeFormatter.toDateMathParser();
this.resolution = resolution;
Expand Down Expand Up @@ -665,6 +665,11 @@ public boolean hasDocValuesSkipper() {
return hasDocValuesSkipper;
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

/**
* Format to use to resolve {@link Number}s from the source. Its valid
* to send the numbers with up to six digits after the decimal place
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static final class DocCountFieldType extends MappedFieldType {
public static final int DEFAULT_VALUE = 1;

public DocCountFieldType() {
super(NAME, false, false, false, TextSearchInfo.NONE, Collections.emptyMap());
super(NAME, false, false, false, Collections.emptyMap());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ private static Mapper getLeafMapper(final DocumentParserContext context, String
private static FieldMapper noopFieldMapper(String path) {
return new FieldMapper(
NOOP_FIELD_MAPPER_NAME,
new MappedFieldType(NOOP_FIELD_MAPPER_NAME, false, false, false, TextSearchInfo.NONE, Collections.emptyMap()) {
new MappedFieldType(NOOP_FIELD_MAPPER_NAME, false, false, false, Collections.emptyMap()) {
@Override
public ValueFetcher valueFetcher(SearchExecutionContext context, String format) {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public InferenceMetadataFieldType fieldType() {

public abstract static class InferenceMetadataFieldType extends MappedFieldType {
public InferenceMetadataFieldType() {
super(NAME, false, false, false, TextSearchInfo.NONE, Map.of());
super(NAME, false, false, false, Map.of());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public IpFieldType(
boolean isDimension,
boolean isSyntheticSource
) {
super(name, indexed, stored, hasDocValues, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, indexed, stored, hasDocValues, meta);
this.nullValue = nullValue;
this.scriptValues = scriptValues;
this.isDimension = isDimension;
Expand Down Expand Up @@ -278,6 +278,11 @@ public boolean isSearchable() {
return isIndexed() || hasDocValues();
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

@Override
public boolean mayExistInIndex(SearchExecutionContext context) {
return context.fieldExistsInIndex(name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private LookupRuntimeFieldType(
String targetField,
List<FieldAndFormat> fetchFields
) {
super(name, false, false, false, TextSearchInfo.NONE, meta);
super(name, false, false, false, meta);
this.lookupIndex = lookupIndex;
this.inputField = inputField;
this.targetField = targetField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;
Expand All @@ -69,22 +68,13 @@ public abstract class MappedFieldType {
private final boolean docValues;
private final boolean isIndexed;
private final boolean isStored;
private final TextSearchInfo textSearchInfo;
private final Map<String, String> meta;

public MappedFieldType(
String name,
boolean isIndexed,
boolean isStored,
boolean hasDocValues,
TextSearchInfo textSearchInfo,
Map<String, String> meta
) {
public MappedFieldType(String name, boolean isIndexed, boolean isStored, boolean hasDocValues, Map<String, String> meta) {
this.name = Mapper.internFieldName(name);
this.isIndexed = isIndexed;
this.isStored = isStored;
this.docValues = hasDocValues;
this.textSearchInfo = Objects.requireNonNull(textSearchInfo);
// meta should be sorted but for the one item or empty case we can fall back to immutable maps to save some memory since order is
// irrelevant
this.meta = meta.size() <= 1 ? Map.copyOf(meta) : meta;
Expand Down Expand Up @@ -649,7 +639,7 @@ public Map<String, String> meta() {
* {@link TextSearchInfo#SIMPLE_MATCH_WITHOUT_TERMS}
*/
public TextSearchInfo getTextSearchInfo() {
return textSearchInfo;
return TextSearchInfo.NONE;
}

public enum CollapseType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ public NumberFieldType(
IndexMode indexMode,
boolean isSyntheticSource
) {
super(name, isIndexed, isStored, hasDocValues, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, isIndexed, isStored, hasDocValues, meta);
this.type = Objects.requireNonNull(type);
this.coerce = coerce;
this.nullValue = nullValue;
Expand Down Expand Up @@ -1957,6 +1957,11 @@ public String typeName() {
return type.name;
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

/**
* This method reinterprets a double precision value based on the maximum precision of the stored number field. Mostly this
* corrects for unrepresentable values which have different approximations when cast from floats than when parsed as doubles.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static final class PlaceHolderFieldType extends MappedFieldType {
private String type;

public PlaceHolderFieldType(String name, String type, Map<String, String> meta) {
super(name, false, false, false, TextSearchInfo.NONE, meta);
super(name, false, false, false, meta);
this.type = type;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public RangeFieldType(
boolean coerce,
Map<String, String> meta
) {
super(name, indexed, stored, hasDocValues, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, indexed, stored, hasDocValues, meta);
assert type != RangeType.DATE;
this.rangeType = Objects.requireNonNull(type);
dateTimeFormatter = null;
Expand All @@ -214,7 +214,7 @@ public RangeFieldType(
boolean coerce,
Map<String, String> meta
) {
super(name, indexed, stored, hasDocValues, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, meta);
super(name, indexed, stored, hasDocValues, meta);
this.rangeType = RangeType.DATE;
this.dateTimeFormatter = Objects.requireNonNull(formatter);
this.dateMathParser = dateTimeFormatter.toDateMathParser();
Expand Down Expand Up @@ -250,6 +250,11 @@ public SortField sortField(
};
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

@Override
public boolean mayExistInIndex(SearchExecutionContext context) {
return context.fieldExistsInIndex(this.name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,19 @@ static final class SeqNoFieldType extends SimpleMappedFieldType {
private static final SeqNoFieldType NO_POINT = new SeqNoFieldType(false);

private SeqNoFieldType(boolean indexed) {
super(NAME, indexed, false, true, TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS, Collections.emptyMap());
super(NAME, indexed, false, true, Collections.emptyMap());
}

@Override
public String typeName() {
return CONTENT_TYPE;
}

@Override
public TextSearchInfo getTextSearchInfo() {
return TextSearchInfo.SIMPLE_MATCH_WITHOUT_TERMS;
}

private static long parse(Object value) {
if (value instanceof Number) {
double doubleValue = ((Number) value).doubleValue();
Expand Down
Loading