Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -84,14 +84,6 @@ public Builder(String name) {
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
public BooleanFieldMapper build(BuilderContext context) {
setupFieldType(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ public T storeTermVectorPayloads(boolean termVectorPayloads) {
return builder;
}

public T tokenized(boolean tokenized) {
this.fieldType.setTokenized(tokenized);
return builder;
}

public T boost(float boost) {
this.fieldType.setBoost(boost);
return builder;
Expand Down Expand Up @@ -376,9 +371,8 @@ protected void doXContentBody(XContentBuilder builder, boolean includeDefaults,

boolean indexed = fieldType().indexOptions() != IndexOptions.NONE;
boolean defaultIndexed = defaultFieldType.indexOptions() != IndexOptions.NONE;
if (includeDefaults || indexed != defaultIndexed ||
fieldType().tokenized() != defaultFieldType.tokenized()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another tokenized() method than the one deleted above, no? I don't know enough about the details of how mappings work, but how are they different? How is this removal in the if-clause related to the rest of this change?

builder.field("index", indexTokenizeOption(indexed, fieldType().tokenized()));
if (includeDefaults || indexed != defaultIndexed) {
builder.field("index", indexed);
}
if (includeDefaults || fieldType().stored() != defaultFieldType.stored()) {
builder.field("store", fieldType().stored());
Expand Down Expand Up @@ -474,11 +468,6 @@ public static String termVectorOptionsToString(FieldType fieldType) {
}
}

/* Only protected so that string can override it */
protected Object indexTokenizeOption(boolean indexed, boolean tokenized) {
return indexed;
}

protected abstract String contentType();

public static class MultiFields {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void checkCompatibility(MappedFieldType other, List<String> conflicts) {
boolean indexed = indexOptions() != IndexOptions.NONE;
boolean mergeWithIndexed = other.indexOptions() != IndexOptions.NONE;
// TODO: should be validating if index options go "up" (but "down" is ok)
if (indexed != mergeWithIndexed || tokenized() != other.tokenized()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this it the field type tokenized flag, no? Not sure if this matters.

if (indexed != mergeWithIndexed) {
conflicts.add("mapper [" + name() + "] has different [index] values");
}
if (stored() != other.stored()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void testBuildThenParse() throws Exception {

DocumentMapper builderDocMapper = new DocumentMapper.Builder(new RootObjectMapper.Builder("person").add(
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))
), indexService.mapperService()).build(indexService.mapperService());

Expand Down