parent
1654ae8937
commit
96cca039e9
|
@ -660,43 +660,50 @@ public class GeoPointFieldMapper extends AbstractFieldMapper<GeoPoint> implement
|
||||||
@Override
|
@Override
|
||||||
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
|
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
|
||||||
super.doXContentBody(builder, includeDefaults, params);
|
super.doXContentBody(builder, includeDefaults, params);
|
||||||
builder.field("type", CONTENT_TYPE);
|
if (includeDefaults || pathType != Defaults.PATH_TYPE) {
|
||||||
if (pathType != Defaults.PATH_TYPE) {
|
|
||||||
builder.field("path", pathType.name().toLowerCase(Locale.ROOT));
|
builder.field("path", pathType.name().toLowerCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
if (enableLatLon != Defaults.ENABLE_LATLON) {
|
if (includeDefaults || enableLatLon != Defaults.ENABLE_LATLON) {
|
||||||
builder.field("lat_lon", enableLatLon);
|
builder.field("lat_lon", enableLatLon);
|
||||||
}
|
}
|
||||||
if (enableGeoHash != Defaults.ENABLE_GEOHASH) {
|
if (includeDefaults || enableGeoHash != Defaults.ENABLE_GEOHASH) {
|
||||||
builder.field("geohash", enableGeoHash);
|
builder.field("geohash", enableGeoHash);
|
||||||
}
|
}
|
||||||
if (enableGeohashPrefix != Defaults.ENABLE_GEOHASH_PREFIX) {
|
if (includeDefaults || enableGeohashPrefix != Defaults.ENABLE_GEOHASH_PREFIX) {
|
||||||
builder.field("geohash_prefix", enableGeohashPrefix);
|
builder.field("geohash_prefix", enableGeohashPrefix);
|
||||||
}
|
}
|
||||||
if (geoHashPrecision != Defaults.GEO_HASH_PRECISION) {
|
if (includeDefaults || geoHashPrecision != Defaults.GEO_HASH_PRECISION) {
|
||||||
builder.field("geohash_precision", geoHashPrecision);
|
builder.field("geohash_precision", geoHashPrecision);
|
||||||
}
|
}
|
||||||
if (precisionStep != null) {
|
if (includeDefaults || precisionStep != null) {
|
||||||
builder.field("precision_step", precisionStep);
|
builder.field("precision_step", precisionStep);
|
||||||
}
|
}
|
||||||
if (!validateLat && !validateLon) {
|
if (includeDefaults || validateLat != Defaults.VALIDATE_LAT || validateLon != Defaults.VALIDATE_LON) {
|
||||||
|
if (validateLat && validateLon) {
|
||||||
|
builder.field("validate", true);
|
||||||
|
} else if (!validateLat && !validateLon) {
|
||||||
builder.field("validate", false);
|
builder.field("validate", false);
|
||||||
} else {
|
} else {
|
||||||
if (validateLat != Defaults.VALIDATE_LAT) {
|
if (includeDefaults || validateLat != Defaults.VALIDATE_LAT) {
|
||||||
builder.field("validate_lat", validateLat);
|
builder.field("validate_lat", validateLat);
|
||||||
}
|
}
|
||||||
if (validateLon != Defaults.VALIDATE_LON) {
|
if (includeDefaults || validateLon != Defaults.VALIDATE_LON) {
|
||||||
builder.field("validate_lon", validateLon);
|
builder.field("validate_lon", validateLon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!normalizeLat && !normalizeLon) {
|
}
|
||||||
|
if (includeDefaults || normalizeLat != Defaults.NORMALIZE_LAT || normalizeLon != Defaults.NORMALIZE_LON) {
|
||||||
|
if (normalizeLat && normalizeLon) {
|
||||||
|
builder.field("normalize", true);
|
||||||
|
} else if (!normalizeLat && !normalizeLon) {
|
||||||
builder.field("normalize", false);
|
builder.field("normalize", false);
|
||||||
} else {
|
} else {
|
||||||
if (normalizeLat != Defaults.NORMALIZE_LAT) {
|
if (includeDefaults || normalizeLat != Defaults.NORMALIZE_LAT) {
|
||||||
builder.field("normalize_lat", normalizeLat);
|
builder.field("normalize_lat", normalizeLat);
|
||||||
}
|
}
|
||||||
if (normalizeLon != Defaults.NORMALIZE_LON) {
|
if (includeDefaults || normalizeLon != Defaults.NORMALIZE_LON) {
|
||||||
builder.field("normalize_lon", normalizeLon);
|
builder.field("normalize_lon", normalizeLat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue