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 @@ -135,7 +135,7 @@ public FeatureVectorFieldType fieldType() {
}

@Override
public FieldMapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
if (context.externalValueSet()) {
throw new IllegalArgumentException("[feature_vector] fields can't be used in multi-fields");
}
Expand Down Expand Up @@ -164,7 +164,6 @@ public FieldMapper parse(ParseContext context) throws IOException {
"float, but got unexpected token " + token);
}
}
return null; // no mapping update
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ protected void parseCreateField(ParseContext context, List<IndexableField> field
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
context.path().add(simpleName());
XContentParser.Token token = context.parser().currentToken();
String name = null;
Expand Down Expand Up @@ -437,7 +437,6 @@ public Mapper parse(ParseContext context) throws IOException {
context.doc().add(field);
context.doc().add(new SortedDocValuesField(fieldType().name(), binaryValue));
context.path().remove();
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public FieldMapper updateFieldType(Map<String, MappedFieldType> fullNameToFieldT
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
QueryShardContext queryShardContext = this.queryShardContext.get();
if (context.doc().getField(queryBuilderField.name()) != null) {
// If a percolator query has been defined in an array object then multiple percolator queries
Expand All @@ -406,7 +406,6 @@ public Mapper parse(ParseContext context) throws IOException {
createQueryBuilderField(indexVersion, queryBuilderField, queryBuilder, context);
Query query = toQuery(queryShardContext, isMapUnmappedFieldAsText(), queryBuilder);
processQuery(query, context);
return null;
}

static void createQueryBuilderField(Version indexVersion, BinaryFieldMapper qbField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,8 @@ public void postParse(ParseContext context) throws IOException {
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// nothing to do here, we call the parent in postParse
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,15 +430,15 @@ public CompletionFieldType fieldType() {
* else adds inputs as a {@link org.apache.lucene.search.suggest.document.SuggestField}
*/
@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// parse
XContentParser parser = context.parser();
Token token = parser.currentToken();
Map<String, CompletionInputMetaData> inputMap = new HashMap<>(1);

// ignore null values
if (token == Token.VALUE_NULL) {
return null;
return;
} else if (token == Token.START_ARRAY) {
while ((token = parser.nextToken()) != Token.END_ARRAY) {
parse(context, token, parser, inputMap);
Expand Down Expand Up @@ -477,7 +477,6 @@ public Mapper parse(ParseContext context) throws IOException {
context.doc().add(field);
}
multiFields.parse(this, context);
return null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,7 @@ private static void parseObjectOrField(ParseContext context, Mapper mapper) thro
parseObjectOrNested(context, (ObjectMapper) mapper);
} else if (mapper instanceof FieldMapper) {
FieldMapper fieldMapper = (FieldMapper) mapper;
Mapper update = fieldMapper.parse(context);
if (update != null) {
context.addDynamicMapper(update);
}
fieldMapper.parse(context);
parseCopyFields(context, fieldMapper.copyTo().copyToFields());
} else if (mapper instanceof FieldAliasMapper) {
throw new IllegalArgumentException("Cannot write to a field alias [" + mapper.name() + "].");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,9 @@ public CopyTo copyTo() {
}

/**
* Parse using the provided {@link ParseContext} and return a mapping
* update if dynamic mappings modified the mappings, or {@code null} if
* mappings were not modified.
* Parse the field value using the provided {@link ParseContext}.
*/
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
final List<IndexableField> fields = new ArrayList<>(2);
try {
parseCreateField(context, fields);
Expand All @@ -280,7 +278,6 @@ public Mapper parse(ParseContext context) throws IOException {
fieldType().typeName());
}
multiFields.parse(this, context);
return null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,8 @@ public void postParse(ParseContext context) throws IOException {
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// Adding values to the _field_names field is handled by the mappers for each field type
return null;
}

static Iterable<String> extractFieldNames(final String fullPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ protected void parse(ParseContext context, GeoPoint point) throws IOException {
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
context.path().add(simpleName());

GeoPoint sparse = context.parseExternalValue(GeoPoint.class);
Expand Down Expand Up @@ -339,7 +339,6 @@ public Mapper parse(ParseContext context) throws IOException {
}

context.path().remove();
return null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ public GeoShapeFieldType fieldType() {
return (GeoShapeFieldType) super.fieldType();
}
@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
try {
Shape shape = context.parseExternalValue(Shape.class);
if (shape == null) {
ShapeBuilder shapeBuilder = ShapeParser.parse(context.parser(), this);
if (shapeBuilder == null) {
return null;
return;
}
shape = shapeBuilder.build();
}
Expand All @@ -501,7 +501,7 @@ public Mapper parse(ParseContext context) throws IOException {
for (Shape s : shapes) {
indexShape(context, s);
}
return null;
return;
} else if (shape instanceof Point == false) {
throw new MapperParsingException("[{" + fieldType().name() + "}] is configured for points only but a " +
((shape instanceof JtsGeometry) ? ((JtsGeometry)shape).getGeom().getGeometryType() : shape.getClass()) + " was found");
Expand All @@ -515,7 +515,6 @@ public Mapper parse(ParseContext context) throws IOException {
}
context.addIgnoredField(fieldType.name());
}
return null;
}

private void indexShape(ParseContext context, Shape shape) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ public void postParse(ParseContext context) throws IOException {
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// done in post-parse
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,10 @@ public void preParse(ParseContext context) throws IOException {
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// no need ot parse here, we either get the routing in the sourceToParse
// or we don't have routing, if we get it in sourceToParse, we process it in preParse
// which will always be called
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,8 @@ protected void parseCreateField(ParseContext context, List<IndexableField> field
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// fields are added in parseCreateField
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,8 @@ public void preParse(ParseContext context) throws IOException {
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// nothing to do here, we will call it in pre parse
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,8 @@ public void preParse(ParseContext context) throws IOException {
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// we parse in pre parse
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ protected void parseCreateField(ParseContext context, List<IndexableField> field
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
// _version added in preparse
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public ExternalMapper(String simpleName, MappedFieldType fieldType,
}

@Override
public Mapper parse(ParseContext context) throws IOException {
public void parse(ParseContext context) throws IOException {
byte[] bytes = "Hello world".getBytes(Charset.defaultCharset());
binMapper.parse(context.createExternalValueContext(bytes));

Expand All @@ -190,7 +190,6 @@ public Mapper parse(ParseContext context) throws IOException {
stringMapper.parse(context);

multiFields.parse(this, context);
return null;
}

@Override
Expand Down