Remove extraneous references to 'tokenized' in the mapper code. (#31010)
These are likely left over from when there were three options for the index mapping ('no', 'analyzed', 'not_analyzed').
This commit is contained in:
parent
a86c0f8c25
commit
2378fa19b8
|
@ -84,14 +84,6 @@ public class BooleanFieldMapper extends FieldMapper {
|
||||||
this.builder = this;
|
this.builder = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder tokenized(boolean tokenized) {
|
|
||||||
if (tokenized) {
|
|
||||||
throw new IllegalArgumentException("bool field can't be tokenized");
|
|
||||||
}
|
|
||||||
return super.tokenized(tokenized);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BooleanFieldMapper build(BuilderContext context) {
|
public BooleanFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
|
|
|
@ -147,11 +147,6 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T tokenized(boolean tokenized) {
|
|
||||||
this.fieldType.setTokenized(tokenized);
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T boost(float boost) {
|
public T boost(float boost) {
|
||||||
this.fieldType.setBoost(boost);
|
this.fieldType.setBoost(boost);
|
||||||
return builder;
|
return builder;
|
||||||
|
@ -376,9 +371,8 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
|
||||||
|
|
||||||
boolean indexed = fieldType().indexOptions() != IndexOptions.NONE;
|
boolean indexed = fieldType().indexOptions() != IndexOptions.NONE;
|
||||||
boolean defaultIndexed = defaultFieldType.indexOptions() != IndexOptions.NONE;
|
boolean defaultIndexed = defaultFieldType.indexOptions() != IndexOptions.NONE;
|
||||||
if (includeDefaults || indexed != defaultIndexed ||
|
if (includeDefaults || indexed != defaultIndexed) {
|
||||||
fieldType().tokenized() != defaultFieldType.tokenized()) {
|
builder.field("index", indexed);
|
||||||
builder.field("index", indexTokenizeOption(indexed, fieldType().tokenized()));
|
|
||||||
}
|
}
|
||||||
if (includeDefaults || fieldType().stored() != defaultFieldType.stored()) {
|
if (includeDefaults || fieldType().stored() != defaultFieldType.stored()) {
|
||||||
builder.field("store", fieldType().stored());
|
builder.field("store", fieldType().stored());
|
||||||
|
@ -474,11 +468,6 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only protected so that string can override it */
|
|
||||||
protected Object indexTokenizeOption(boolean indexed, boolean tokenized) {
|
|
||||||
return indexed;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract String contentType();
|
protected abstract String contentType();
|
||||||
|
|
||||||
public static class MultiFields {
|
public static class MultiFields {
|
||||||
|
|
|
@ -165,7 +165,7 @@ public abstract class MappedFieldType extends FieldType {
|
||||||
boolean indexed = indexOptions() != IndexOptions.NONE;
|
boolean indexed = indexOptions() != IndexOptions.NONE;
|
||||||
boolean mergeWithIndexed = other.indexOptions() != IndexOptions.NONE;
|
boolean mergeWithIndexed = other.indexOptions() != IndexOptions.NONE;
|
||||||
// TODO: should be validating if index options go "up" (but "down" is ok)
|
// TODO: should be validating if index options go "up" (but "down" is ok)
|
||||||
if (indexed != mergeWithIndexed || tokenized() != other.tokenized()) {
|
if (indexed != mergeWithIndexed) {
|
||||||
conflicts.add("mapper [" + name() + "] has different [index] values");
|
conflicts.add("mapper [" + name() + "] has different [index] values");
|
||||||
}
|
}
|
||||||
if (stored() != other.stored()) {
|
if (stored() != other.stored()) {
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class MultiFieldTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
DocumentMapper builderDocMapper = new DocumentMapper.Builder(new RootObjectMapper.Builder("person").add(
|
DocumentMapper builderDocMapper = new DocumentMapper.Builder(new RootObjectMapper.Builder("person").add(
|
||||||
new TextFieldMapper.Builder("name").store(true)
|
new TextFieldMapper.Builder("name").store(true)
|
||||||
.addMultiField(new TextFieldMapper.Builder("indexed").index(true).tokenized(true))
|
.addMultiField(new TextFieldMapper.Builder("indexed").index(true))
|
||||||
.addMultiField(new TextFieldMapper.Builder("not_indexed").index(false).store(true))
|
.addMultiField(new TextFieldMapper.Builder("not_indexed").index(false).store(true))
|
||||||
), indexService.mapperService()).build(indexService.mapperService());
|
), indexService.mapperService()).build(indexService.mapperService());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue