Class<?> rawMapType = mapTypeInformation.getType();
Map<?, ?> map = (Map<?, ?>) fieldValue;
for (Map.Entry<?, ?> entry : map.entrySet()) {
String mappedFieldName = entry.getKey().toString();
SolrInputField field = new SolrInputField(mappedFieldName);
if (entry.getValue() instanceof Iterable) {
for (Object o : (Iterable<?>) entry.getValue()) {
field.addValue(convertToSolrType(rawMapType, o), 1f);
}
} else {
if (rawMapType.isArray()) {
for (Object o : (Object[]) entry.getValue()) {
field.addValue(convertToSolrType(rawMapType, o), 1f);
}
} else {
field.addValue(convertToSolrType(rawMapType, entry.getValue()), 1f);
}
}
target.put(mappedFieldName, field);
}
return;
}
SolrInputField field = new SolrInputField(persistentProperty.getFieldName());
if (persistentProperty.isCollectionLike()) {
Collection<?> collection = asCollection(fieldValue);
for (Object o : collection) {
if (o != null) {
field.addValue(convertToSolrType(persistentProperty.getType(), o), 1f);
}
}
} else {
field.setValue(convertToSolrType(persistentProperty.getType(), fieldValue), 1f);
}
target.put(persistentProperty.getFieldName(), field);
if (persistentProperty.isBoosted()) {
field.setBoost(persistentProperty.getBoost());
}
}
});